Compression
zlib.inflateSync()
Decodes zlib-wrapped DEFLATE data synchronously. Bound output size and avoid synchronous decoding of untrusted large inputs in a server. Tested on Node.js 22.16.0. Example output (one line per entry): ["book"].
Formal Syntax & Structure
nodejs syntaxnodejs
zlib.inflateSync(buffer[, options])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| buffer | Buffer | string | TypedArray | DataView | ArrayBuffer | Compressed input. |
| options | object | Decompression options. |
Return Value
Buffer
Decoded bytes.
Working Example
Example Snippetnodejs
import { deflateSync, inflateSync } from 'node:zlib';console.log(inflateSync(deflateSync('book'), { maxOutputLength: 16 }).toString());