mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
21 lines
436 B
Plaintext
21 lines
436 B
Plaintext
---
|
|
title: Compress and decompress data with DEFLATE
|
|
sidebarTitle: DEFLATE compression
|
|
mode: center
|
|
---
|
|
|
|
Use `Bun.deflateSync()` to compress a `Uint8Array` with DEFLATE.
|
|
|
|
```ts
|
|
const data = Buffer.from("Hello, world!");
|
|
const compressed = Bun.deflateSync("Hello, world!");
|
|
// => Uint8Array
|
|
|
|
const decompressed = Bun.inflateSync(compressed);
|
|
// => Uint8Array
|
|
```
|
|
|
|
---
|
|
|
|
See [Docs > API > Utils](/runtime/utils) for more useful utilities.
|