thriftify
v1.0.0-alpha14
Published
thrift compiler in js
Downloads
209
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-licenceThis will add the licence headers.npm run coverThis runs the tests with code coveragenpm run lintThis will run the linter on your codenpm testThis will run the tests.npm run traceThis will run your tests in tracing mode.npm run travisThis is run by travis.CI to run your testsnpm run view-coverThis will show code coverage in a browser
Contributors
- Lei Zhao
