PyDocs

Data Compression and Archiving

zlib

The functions in this module allow compression and decompression using the
zlib library, which is based on GNU zip.

adler32(string[, start]) -- Compute an Adler-32 checksum.
adler32_combine(adler1, adler2, len2, /) -- Combine two Adler-32 checksums.
compress(data[, level]) -- Compress data, with compression level 0-9 or -1.
compressobj([level[, ...]]) -- Return a compressor object.
crc32(string[, start]) -- Compute a CRC-32 checksum.
crc32_combine(crc1, crc2, len2, /) -- Combine two CRC-32 checksums.
decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.
decompressobj([wbits[, zdict]]) -- Return a decompressor object.

'wbits' is window buffer size and container format.
Compressor objects support compress() and flush() methods; decompressor
objects support decompress() and flush().
Symbols in zlib

a

adler32
Compute an Adler-32 checksum of data.
adler32_combine
Combine two Adler-32 checksums into one.

c

compress
Returns a bytes object containing compressed data.
Compress.compress
Compress data, returning a bytes object containing compressed data for at least part of the data in data.
Compress.copy
Returns a copy of the compression object.
Compress.flush
All pending input is processed, and a bytes object containing the remaining compressed output is returned.
compressobj
Return a compressor object.
crc32
Compute a CRC-32 checksum of data.
crc32_combine
Combine two CRC-32 checksums into one.

d

decompress
Returns a bytes object containing the uncompressed data.
Decompress.copy
Returns a copy of the decompression object.
Decompress.decompress
Decompress data, returning a bytes object containing the uncompressed data corresponding to at least part of the data in string.
Decompress.eof
A boolean indicating whether the end of the compressed data stream has been reached.
Decompress.flush
All pending input is processed, and a bytes object containing the remaining uncompressed output is returned.
Decompress.unconsumed_tail
A bytes object that contains any data that was not consumed by the last decompress() call because it exceeded the limit for the uncompressed data buffer.
Decompress.unused_data
A bytes object which contains any bytes past the end of the compressed data.
decompressobj
Return a decompressor object.
DEF_BUF_SIZE
The default buffer size for decompression operations.
DEF_MEM_LEVEL
The default memory level for compression objects.
DEFLATED
The deflate compression method.

e

error
Exception raised on compression and decompression errors.

m

MAX_WBITS
The maximum window size, expressed as a power of 2.

z

Z_BEST_COMPRESSION
Compression level 9; slowest and produces the most compression.
Z_BEST_SPEED
Compression level 1; fastest and produces the least compression.
Z_BLOCK
Flush mode 5.
Z_DEFAULT_COMPRESSION
Default compression level (-1); a compromise between speed and compression.
Z_DEFAULT_STRATEGY
Default compression strategy, for normal data.
Z_FILTERED
Compression strategy for data produced by a filter (or predictor).
Z_FINISH
Flush mode 4.
Z_FIXED
Compression strategy that prevents the use of dynamic Huffman codes.
Z_FULL_FLUSH
Flush mode 3.
Z_HUFFMAN_ONLY
Compression strategy that forces Huffman coding only.
Z_NO_COMPRESSION
Compression level 0; no compression.
Z_NO_FLUSH
Flush mode 0.
Z_PARTIAL_FLUSH
Flush mode 1.
Z_RLE
Compression strategy that limits match distances to one (run-length encoding).
Z_SYNC_FLUSH
Flush mode 2.
Z_TREES
Flush mode 6, for inflate operations.
ZLIB_RUNTIME_VERSION
The version string of the zlib library actually loaded by the interpreter.
ZLIB_VERSION
The version string of the zlib library that was used for building the module.
ZLIBNG_VERSION
The version string of the zlib-ng library that was used for building the module if zlib-ng was used.