1.1.0 • Published 6 years ago

flatc v1.1.0

Weekly downloads
17
License
SEE SEPARATE LICE...
Repository
github
Last release
6 years ago

flatc.js

Node.js bindings for Google FlatBuffers compiler.

Purpose

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.

Requirements

Under Linux, you need to have cmake and g++ (or some other supported compiler) installed.

Installation

npm install --save-dev flatc

Usage

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.

Options

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,
}