Skip to content
This repository has been archived by the owner on Jun 16, 2020. It is now read-only.

Pluto-tv/flatc-js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

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

Packages

No packages published

Languages

  • JavaScript 100.0%