Skip to content
io
inflate

inflate

Mojo function 🡭

inflate

fn def inflate(var compressed: List[UInt8]) -> List[UInt8]

Decompress a raw DEFLATE stream (RFC 1951), not a zlib stream (RFC 1950): a caller holding a zlib-wrapped stream, such as PNG’s IDAT data, strips the 2-byte header and 4-byte Adler-32 trailer first. Direct translation of puff.c’s top-level puff() loop.

Takes ownership of compressed, moving it into the bit reader rather than copying.

Args:

  • compressed (List[UInt8]): Raw DEFLATE bytes, no zlib wrapper.

Returns:

List[UInt8]: The decompressed bytes.

Raises:

Error: compressed is truncated or malformed.