Skip to content

dapaulid/flatc-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Node.js bindings for Google FlatBuffers compiler (https://github.com/google/flatbuffers).

Resources

License

Stars

Watchers

Forks

Packages

No packages published