thriftify

1.0.0-alpha14 • Public • Published

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 coverage
  • npm run lint This will run the linter on your code
  • npm 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 tests
  • npm run view-cover This will show code coverage in a browser

Contributors

  • Lei Zhao

MIT Licenced

Readme

Keywords

none

Package Sidebar

Install

npm i thriftify

Weekly Downloads

7

Version

1.0.0-alpha14

License

none

Last publish

Collaborators

  • rtsao
  • usiarhei
  • kenns29
  • shengs
  • emrahs
  • zacklk
  • uber-ospo
  • kriskowal
  • leizha