mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
21 lines
425 B
Plaintext
21 lines
425 B
Plaintext
---
|
|
title: Compress and decompress data with gzip
|
|
sidebarTitle: Gzip compression
|
|
mode: center
|
|
---
|
|
|
|
Use `Bun.gzipSync()` to compress a `Uint8Array` with gzip.
|
|
|
|
```ts
|
|
const data = Buffer.from("Hello, world!");
|
|
const compressed = Bun.gzipSync(data);
|
|
// => Uint8Array
|
|
|
|
const decompressed = Bun.gunzipSync(compressed);
|
|
// => Uint8Array
|
|
```
|
|
|
|
---
|
|
|
|
See [Docs > API > Utils](https://bun.com/docs/api/utils) for more useful utilities.
|