Skip to content

使用 Bun.gzipSync() 用 gzip 压缩 Uint8Array

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

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

请参阅 文档 > API > Utils 获取更多有用的工具函数。

Bun学习网由www.bunjs.com.cn整理维护