Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parse(buffer, type) {
var transport = new thrift.TFramedTransport(buffer)
var protocol = new thrift.TCompactProtocol(transport)
type.read(protocol)
module.exports.bytes = parse.bytes = protocol.trans.readPos
return type
}
function parseThrift(thriftEncodedData, callback) {
var thrift = require('thrift');
var transport = new thrift.TFramedTransport(thriftEncodedData);
var protocol = new thrift.TBinaryProtocol(transport);
var clientClass = require('../gen-nodejs/GENERATED').YOUR_CLASS_NAME;
var client = new clientClass();
client.read(protocol);
callback(null, client);
}
exports.decodeThrift = function(obj, buf, offset) {
if (!offset) {
offset = 0;
}
var transport = new thrift.TFramedTransport(buf);
transport.readPos = offset;
var protocol = new thrift.TCompactProtocol(transport);
obj.read(protocol);
return transport.readPos - offset;
}