zerobuf
Structured data in WebAssembly.Memory. Works in any JS runtime — browser, Worker, Node, Deno, Bun.
What it does
Section titled “What it does”zerobuf defines a binary layout (tagged values, strings, arrays, objects) over WebAssembly.Memory and gives you JS accessor objects that read/write directly — no serialization, no copies.
You can use it with a WASM module (Zig, Rust, C, etc.) for shared-memory interop, or standalone with just new WebAssembly.Memory() as a structured binary buffer.
import { zerobuf } from "zerobuf";
// Standalone — no WASM module neededconst buf = zerobuf(new WebAssembly.Memory({ initial: 1 }));const point = buf.create({ x: 1.0, y: 2.0, label: "origin" });point.x = 3.14; // writes to memoryconsole.log(point.x); // reads from memory
// Or with WASM — both sides share the same memoryconst buf2 = zerobuf(wasm.exports.memory);Where it runs
Section titled “Where it runs”Anywhere WebAssembly.Memory is available:
- Browser (main thread, Web Workers, Service Workers)
- Cloudflare Workers and Durable Objects
- Node.js, Deno, Bun
Architecture
Section titled “Architecture”Current state
Section titled “Current state”- JS library with defineProperty accessors (V8-optimized reads, ~8M ops/sec)
- Zig library with matching binary layout and C ABI exports
- Dynamic objects: push, extend, grow, add properties
- All types: null, bool, i32, f64, bigint, string, bytes, array, object
- Schema mode: fixed-layout objects with precomputed offsets, no Proxy
- Arena save/restore for per-request cleanup in long-lived processes