JavaScript compression/decompression with snappy for browsers and Node.js, powered by WebAssembly.
Built with 🦀🕸 by The Rust and WebAssembly Working Group
npm i snappy-wasm
import init from 'snappy-wasm'
// ...
const snappy = await init()Note that additional configuration may be required to support top-level await in your environment.
const snappy = require('snappy-wasm')For use exclusively in Node.js, the snappy package may provide better performance.
const data: Uint8Array = ...;
const compressed: Uint8Array = snappy.compress(data)const decompressed: Uint8Array = snappy.decompress(compressed)npm run build
wasm-pack test --headless --firefox
npm run build
npm publish
wasm-bindgenfor communicating between WebAssembly and JavaScript.
Install the following