FlatBuffers compiler (flatc) compiled to WebAssembly, enabling schema management, JSON/binary conversion, and code generation in Node.js (18+) and modern browsers without native dependencies. Current stable version 26.1.32, released February 2025. Key differentiators: self-contained with inlined WASM binaries, zero native deps, supports 13 code generation languages (C++, TypeScript, Go, Rust, Python, Java, etc.), per-field AES-256-CTR encryption, streaming APIs for large data, JSON Schema import/export, and embedded language runtimes. Licensed under Apache 2.0. Maintained by DigitalArsenal on GitHub.
npm install flatc-wasmNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates loading a FlatBuffers schema, converting between JSON and binary, and generating TypeScript code using FlatcRunner.
Use await FlatcRunner.create() instead of new FlatcRunner().
Migrate to FlatcRunner API for easier usage and better error handling.
const buffer = Buffer.from(await runner.jsonToBinary(...));
Upgrade Node.js to 18.0.0 or later.
Ensure schema name matches the file stem, e.g., 'monster' for 'monster.fbs'.
Ensure the WASM binary is served with the correct MIME type 'application/wasm' and loaded via fetch or import. In webpack, add a rule to load .wasm files as WebAssemblyModule.
Use const runner = await FlatcRunner.create();
Call await runner.addSchema('monster', schemaContent) first.Verify that the binary was generated by flatc or by jsonToBinary with the correct schema and root type.