@chainsafe/snappy-wasm
v0.5.0
Published
snappy compression/decompression for Node.js, powered by WebAssembly
Downloads
1,038
Readme
JavaScript compression/decompression with snappy for browsers and Node.js, powered by WebAssembly.
Built with 🦀🕸 by The Rust and WebAssembly Working Group
Installation
npm i snappy-wasm🚴 Usage
Browser / ES Modules
import init from 'snappy-wasm'
// ...
const snappy = await init()Note that additional configuration may be required to support top-level await in your environment.
Node.js
const snappy = require('snappy-wasm')For use exclusively in Node.js, the snappy package may provide better performance.
Compress data
const data: Uint8Array = ...;
const compressed: Uint8Array = snappy.compress(data)Decompress data
const decompressed: Uint8Array = snappy.decompress(compressed)🛠️ Build with wasm-pack build (via npm script)
npm run build🔬 Test in Headless Browsers with wasm-pack test
wasm-pack test --headless --firefox🎁 Publish to NPM
npm run build
npm publish🔋 Batteries Included
wasm-bindgenfor communicating between WebAssembly and JavaScript.
👾 Development
Install the following
