Bun Compress and decompress data with gzip

Compress and decompress data with gzip

jarle Updated

File contents

Compress and decompress data with gzip

Use Bun.gzipSync() to compress a Uint8Array with gzip.

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

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

See Docs > API > Utils for more useful utilities.

jarle/bun-skills/tree/main/skills/bun-guides-util-gzip commit c6d7b2be36

Frequently asked questions

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