thriftify
v1.0.0-alpha14
Published
thrift compiler in js
Downloads
20
Keywords
Readme
thriftify
thrift compiler in js
Example
var thriftify = require("thriftify");
var path = require('path');
/*example.thrift
struct SomeStruct {
1:i32 someInt
}
struct BarResult {
1:bool someBool
}
service foo {
BarResult bar(1:string someString, 2:SomeStruct someStruct)
}
*/
var spec = thriftify.readSpecSync(path.join(__dirname, 'example.thrift'));
var buf = thriftify.toBuffer({
someString: 'foobar',
someStruct: {
someInt: 24
}
}, spec, 'foo::bar_args');
// send the `buf` over the wire somewhere
var result = thriftify.fromBuffer(someBuf, spec, 'foo::bar_result');
console.log(result.success); // { someBool: false }
Installation
npm install thriftify
Tests
npm test
NPM scripts
npm run add-licence
This will add the licence headers.npm run cover
This runs the tests with code coveragenpm run lint
This will run the linter on your codenpm test
This will run the tests.npm run trace
This will run your tests in tracing mode.npm run travis
This is run by travis.CI to run your testsnpm run view-cover
This will show code coverage in a browser
Contributors
- Lei Zhao