Function: inflate()
inflate(
bytes,maxBytes):Promise<Uint8Array<ArrayBuffer>>
Defined in: src/lib/image/index.ts:126
Decompress deflated bytes using the built-in DecompressionStream.
Stops and throws as soon as the output exceeds maxBytes, so malicious data cannot exhaust memory (decompression bomb).
Parameters
bytes
Uint8Array<ArrayBuffer>
maxBytes
number
Returns
Promise<Uint8Array<ArrayBuffer>>
Example
const rgba = await inflate(compressed, 2000 * 2000 * 4);