Bun

指南實用程式

使用 Bun 壓縮和解壓縮資料(gzip)

使用 Bun.gzipSync() 方法使用 gzip 壓縮 Uint8Array

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

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

有關更多有用的工具,請參閱 文件 > API > 工具