turbo-xlsx-wasm
v0.1.4
Published
Workbook model to .xlsx in the browser via WebAssembly — wasm-bindgen binding for turbo-xlsx-core.
Readme
turbo-xlsx-wasm
The in-browser build of turbo-xlsx:
a structured workbook model → formatted .xlsx writer compiled to WebAssembly
(wasm-bindgen). Same Rust core as the Node / Python bindings — accountant-grade
number formats, styled headers, freeze panes, a streaming writer — running
client-side with no server round-trip.
Install
npm install turbo-xlsx-wasm # writer + encryption (~229 KB gzipped)
npm install turbo-xlsx-wasm-parse # + XLSX reader (~252 KB gzipped, adds parse())Two variants, like the napi packages: the base is write-only; -parse adds an
.xlsx reader. parse() exists only in the -parse build.
Use
import init, { write, parse } from "turbo-xlsx-wasm";
await init();
const { xlsx } = write({
locale: "es-MX",
sheets: [{ name: "S", rows: [
{ cells: [{ type: "string", value: "Alice" }, { type: "number", value: 42 }] },
] }],
});
// xlsx is a Uint8Array (the .xlsx, starts with the PK zip magic).
// parse() — turbo-xlsx-wasm-parse only:
const grid = JSON.parse(parse(xlsx)); // { sheets: [{ name, rows }] }
const csv = parse(xlsx, { format: "csv" });write / writeFromJson / writeRows / createWriter mirror the Node API and
return { xlsx: Uint8Array, diagnostics }. Fatal faults throw a structured
{ code } error.
Password protection: pass { password } to encrypt the output with ECMA-376
Agile Encryption (AES-256) — the CSPRNG runs through the browser's Web Crypto API.
See the repo for the full workbook schema and benchmarks.
License
MIT
