@wasm-zoo/brotli
v0.1.0
Published
Brotli 1.2.0 compiled for browser WebAssembly by WASM Zoo, with Consumer API v1 and bundled runtime assets.
Downloads
164
Maintainers
Readme
@wasm-zoo/brotli
Unofficial WASM Zoo distribution of the upstream Google Brotli 1.2.0 CLI for browsers. This package is backed by Brotli 1.2.0, Zoo builder 0.1.0, and the reviewed browser-full Release asset.
Install
npm install @wasm-zoo/brotliUse
import { load } from "@wasm-zoo/brotli";
const brotli = await load();
try {
const compressed = await brotli.exec(["-q", "11", "-o", "/output.br", "/input.bin"], {
files: [{ name: "/input.bin", data: inputBytes }],
outputs: ["/output.br"]
});
console.log(compressed.files[0].data);
} finally {
brotli.dispose();
}The default entry imports the reviewed browser wrapper and uses static new URL(..., import.meta.url) references so modern bundlers can emit brotli-core.js, brotli-core.wasm. For manual/self-hosted deployments use @wasm-zoo/brotli/self-hosted and the Consumer API v1 baseUrl contract.
Single-threaded upstream brotli CLI in an isolated Web Worker with Emscripten MEMFS. No SharedArrayBuffer or cross-origin isolation is required. Inputs and outputs are explicitly staged in browser memory; the package preserves ordinary upstream CLI arguments rather than replacing Brotli with a JavaScript codec API.
