A streaming deflate compressor. Feed data incrementally with write,
then call finish to flush remaining output and close the stream.
@class Deflate
@eryx/compression/zlib ModuleZlib utilities: compress/decompress, checksums, and helpers.
A streaming deflate compressor. Feed data incrementally with write,
then call finish to flush remaining output and close the stream.
@class Deflate
Compresses a chunk of input data. Returns compressed output (may be empty if zlib is buffering). Use flush constants (FLUSH_SYNC, FLUSH_FULL) to force output.
input bytes to compress
flush mode (FLUSH_NO, FLUSH_SYNC, FLUSH_FULL)
compressed output (may be empty)
Finishes the stream: flushes all remaining data and closes the compressor.
final compressed output
Closes the stream without finishing, freeing resources.
A streaming inflate decompressor. Feed compressed chunks with write;
the second return value indicates when the stream is complete.
@class Inflate
Decompresses a chunk of compressed data. Returns decompressed output and a boolean indicating whether the stream has ended.
compressed bytes
decompressed output
true when the stream is fully decompressed
Closes the stream, freeing resources.
Standard zlib compress (zlib header + Adler-32 trailer).
input bytes to compress
compression level (NO_COMPRESSION..BEST_COMPRESSION)
compressed zlib stream
Full deflateInit2 access. Use windowBits=RAW_WBITS(-15) for headerless raw deflate, GZIP_WBITS(MAX_WBITS+16) for gzip, AUTO_WBITS(MAX_WBITS+32) to auto-detect. memLevel 1-9 trades memory for speed. strategy: STRATEGY_*.
input bytes to compress
compression level
window bits preset (MAX_WBITS/RAW_WBITS/etc)
memory level 1..9
compression strategy constant
deflate stream (no outer wrapper unless windowBits requests it)
Standard zlib inflate.
zlib-wrapped compressed data
decompressed bytes
Inflate with custom windowBits (e.g. RAW_WBITS for raw deflate streams).
compressed stream
window bits preset
decompressed bytes
Running Adler-32 checksum. Pass previous result as initial to chain.
input bytes to checksum
previous checksum to continue from
number checksum value
Running CRC-32 checksum. Pass previous result as initial to chain.
input bytes to checksum
previous checksum to continue from
number checksum value
Upper bound on compressed output size for input of len bytes.
input length in bytes
number upper bound in bytes
Creates a streaming deflate compressor.
compression level
window bits (MAX_WBITS, RAW_WBITS, GZIP_WBITS)
memory level 1..9
compression strategy
the streaming compressor
Creates a streaming inflate decompressor.
window bits (MAX_WBITS, RAW_WBITS, AUTO_WBITS)
the streaming decompressor
zlib.NO_COMPRESSION = 0zlib.BEST_SPEED = 1zlib.BEST_COMPRESSION = 9zlib.STRATEGY_DEFAULT = 0zlib.STRATEGY_FILTERED = 1zlib.STRATEGY_HUFFMAN_ONLY = 2zlib.STRATEGY_RLE = 3zlib.STRATEGY_FIXED = 4zlib.FLUSH_NO = 0zlib.FLUSH_SYNC = 2zlib.FLUSH_FULL = 3zlib.FLUSH_FINISH = 4zlib.MAX_WBITS = 15 - standard zlibzlib.GZIP_WBITS = 31 - gzip wrapperzlib.AUTO_WBITS = 47 - auto-detect zlib or gzip on decompress