Node.js bindings for Google FlatBuffers compiler.
This module provides a simple wrapper around Google FlatBuffers compiler (flatc
) in order to make it usable in Node.js.
The required binaries are either downloaded directly (Windows) or built from source (Linux) from the official release.
Under Linux, you need to have cmake
and g++
(or some other supported compiler) installed.
npm install --save-dev flatc
const flatc = require('flatc');
flatc("monster.fbs", {
language: ["js", "ts"],
outputDir: "output",
}).then(() => {
console.log("Done!");
}).catch(console.error);
If you have the glob
module installed, you can also use patterns like *.fbs
for specifying input files.
The wrapper just passes through boolean properties as flags. For more information see the FlatBuffers documentation.
const default_options = {
language: "js",
outputDir: null,
genMutable: false,
genObjectApi: false,
genOnefile: false,
genAll: false,
noJsExports: false,
googJsExport: false,
}