Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
EncodeSuite.prototype.__flatbuffers = function (args) {
var message = flatbuffers.compileSchema(fs.readFileSync(args));
var val = this.getValue(true);
return function () {
var buf = Buffer.from(message.generate(val).buffer);
if (!buf.length) {
throw new Error();
}
};
};
DecodeSuite.prototype.__flatbuffers = function (args) {
var root = flatbuffers.compileSchema(fs.readFileSync(args));
var buf = Buffer.from(root.generate(this.getValue()));
return function () {
var obj = root.parse(buf);
if (obj.$) {
throw new Error();
}
};
};