Gathering detailed insights and metrics for flatbuffers-addon
Gathering detailed insights and metrics for flatbuffers-addon
Gathering detailed insights and metrics for flatbuffers-addon
Gathering detailed insights and metrics for flatbuffers-addon
npm install flatbuffers-addon
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (74.5%)
C++ (21.53%)
Python (3.97%)
Total Downloads
16,481
Last Day
1
Last Week
13
Last Month
41
Last Year
2,345
3 Stars
41 Commits
2 Watching
11 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
flatbuffers-addon@1.0.4
Unpacked Size
1.31 MB
Size
540.32 kB
File Count
14
NPM Version
6.14.4
Node Version
12.18.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
333.3%
13
Compared to previous week
Last month
1,266.7%
41
Compared to previous month
Last year
-77%
2,345
Compared to previous year
Generate flatbuffers directly from node.
1const flatc = require("flatbuffers-addon"); 2const buffer = flatc.binary(options);
type: String|Buffer
if schema
is a String and schema_contents
is null
or undefined
, schema
will be treated as schema_contents
.
otherwise, it will be treated as the schema file path.
type: String|Buffer
The schema contents.
If the schema_contents
is a schema binary, the schema
file path must end with .bfbs
.
type: bool
default: false
Serialize schemas instead of JSON
type: String|Buffer|Object
if json
is a String and json_contents
is null
or undefined
, json
will be treated as json_contents
.
if json
is a Buffer or an Object, json
will be treated as json_contents
.
otherwise json
must be a String and will be treated as the path to the JSON.
type: String|Buffer|Object
The JSON to serialize
type: [String]
Include directories for schemas
type: String|Buffer
Specify a schema the following schema
should be an evolution of.
if conform
is a String and conform_contents
is null
or undefined
, conform
will be treated as conform_contents
.
type: String|Buffer
Conform schema contents.
type: [String]
Include directories for conform schemas
NOT TESTED
type: bool
default: false
field names must be / will be quoted, no trailing commas in tables/vectors.
type: bool
default: false
Allow scalar fields to be null
NOT TESTED
type: bool
default: false
Pass non-UTF-8 input through parser
type: bool
default: false
Allow fields in JSON that are not defined in the schema. These fields will be discared when generating binaries.
NOT TESTED
type: bool
default: false
Input binaries are size prefixed buffers.
NOT TESTED
type: bool
default: false
Input is a .proto, translate to .fbs.
NOT TESTED
type: bool
default: false
Translate .proto oneofs to flatbuffer unions.
NOT TESTED
type: bool
default: false
Add doc comments to the binary schema files.
NOT TESTED
type: bool
default: false
Add builtin attributes to the binary schema files.
type: bool
default: false
If false, don't serialize values equal to the default, therefore reducing size of the binary output.
1const flatc = require("flatbuffers-addon"); 2const code = flatc.js(options);
type: String|Buffer
if schema
is a String and schema_contents
is null
or undefined
, schema
will be treated as schema_contents
.
otherwise, it will be treated as the schema file path.
type: String|Buffer
The schema contents.
If the schema_contents
is a schema binary, the schema
file path must end with .bfbs
.
type: [String]
Include directories for schemas
type: String|Buffer
Specify a schema the following schema
should be an evolution of.
if conform
is a String and conform_contents
is null
or undefined
, conform
will be treated as conform_contents
.
type: String|Buffer
Conform schema contents.
type: [String]
Include directories for conform schemas
NOT TESTED
type: String
ts
to generate TypeScript code.
NOT TESTED
type: bool
default: false
Pass non-UTF-8 input through parser
type: bool
default: false
Generate accessors that can mutate buffers in-place.
NOT TESTED
type: bool
default: false
Generate not just code for the current schema files, but for all files it includes as well. If the language uses a single file for output (by default the case for C++ and JS), all code will end up in this one file.
type: bool
default: false
Removes Node.js style export lines in JS.
NOT TESTED
type: bool
default: false
Uses goog.exports* for closure compiler exporting in JS.
NOT TESTED
type: bool
default: false
Uses ECMAScript 6 export style lines in JS.
NOT TESTED
type: bool
default: false
Keep original prefix of schema include statement.
NOT TESTED
type: bool
default: false
Don't include flatbuffers import statement for TypeScript.
NOT TESTED
type: bool
default: true
re-export imported dependencies for TypeScript
NOT TESTED
type: bool
default: true
Use short function names for JS and TypeScript.
1const { flatbuffers } = require("flatbuffers"); 2const flatc = require("flatbuffers-addon"); 3 4const schema = ` 5 namespace some.nested.namespace; 6 7 file_extension "dat"; 8 9 table Book { 10 id:string (id: 0); 11 title:string (id: 1); 12 authors:[string] (id: 2); 13 release:ulong (id: 3); 14 genres: [ulong] (id: 4); 15 } 16 17 table Library { 18 name:string (id: 0); 19 books: [Book] (id: 1); 20 } 21 22 root_type Library; 23`; 24 25const js = flatc.js({ 26 schema 27}); 28 29const library = { 30 name: "BookShop 0", 31 books: [{ 32 id: "book-0", 33 title: "Book 0", 34 authors: ["Author 0"] 35 }] 36}; 37 38 39const buffer = flatc.binary({ 40 schema, 41 json: library 42}); 43 44const deserialized = ((code, binary) => { 45 // Evalute generated js code 46 const sandbox = {}; 47 (new Function(code)).call(sandbox); 48 49 // @see https://google.github.io/flatbuffers/flatbuffers_guide_use_javascript.html 50 const bytes = new Uint8Array(binary); 51 const buf = new flatbuffers.ByteBuffer(bytes); 52 53 // Deserialized flatbuffers binary data 54 const Library = sandbox.some.nested.namespace.Library; 55 return Library.getRootAsLibrary(buf); 56 57})(js, buffer); 58 59console.log(deserialized.name() === "BookShop 0"); 60console.log(deserialized.books(0).title() === "Book 0"); 61
No vulnerabilities found.
Reason
binaries present in source code
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
26 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More