Bun Compress and decompress data with DEFLATE

Compress and decompress data with DEFLATE

jarle Updated

File contents

Compress and decompress data with DEFLATE

Use Bun.deflateSync() to compress a Uint8Array with DEFLATE.

const data = Buffer.from("Hello, world!");
const compressed = Bun.deflateSync("Hello, world!");
// => Uint8Array

const decompressed = Bun.inflateSync(compressed);
// => Uint8Array

See Docs > API > Utils for more useful utilities.

jarle/bun-skills/tree/main/skills/bun-guides-util-deflate commit 7bac726cb7

Frequently asked questions

npx skillmds@latest add jarle/bun-compress-and-decompress-data-with-deflate