$ npm install thriftify
thrift compiler in js
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 }
npm install thriftify
npm test
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© 2010 - cnpmjs.org x YWFE | Home | YWFE