Package Exports
- @cloudpss/zstd
- @cloudpss/zstd/package.json
- @cloudpss/zstd/wasm
Readme
@cloudpss/zstd
This package contains the zstd n-api addon for node.js & wasm for browsers.
Installation
npm install @cloudpss/zstdUsage
import { compress, decompress } from '@cloudpss/zstd';
const compressed = compress(Buffer.from('Hello World!'));
const decompressed = decompress(compressed);
console.log(decompressed.toString()); // Hello World!API
compress(input: Buffer, level?: number): Buffer
Compresses the input buffer with the given compression level (default: 4).
decompress(input: Buffer): Buffer
Decompresses the input buffer.
Notice: If you are using this library in a browser, the Buffer classes is replaced with Uint8Array classes.