All Projects → uber-archive → thriftify

uber-archive / thriftify

Licence: MIT license
JavaScript implementation of Thrift encoding and decoding

Programming Languages

javascript
184084 projects - #8 most used programming language
Thrift
134 projects

DEPRECATED, use thriftrw

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].