:mod:`zlib` --- Compression compatible with :program:`gzip`
For applications that require data compression, the functions in this module allow compression and decompression, using the zlib library. The zlib library has its own home page at http://www.zlib.net. There are known incompatibilities between the Python module and versions of the zlib library earlier than 1.1.3; 1.1.3 has a security vulnerability, so we recommend using 1.1.4 or later.
zlib's functions have many options and often need to be used in a particular order. This documentation doesn't attempt to cover all of the permutations; consult the zlib manual at http://www.zlib.net/manual.html for authoritative information.
For reading and writing .gz files see the :mod:`gzip` module.
The available exception and functions in this module are:
To generate the same numeric value across all Python versions and platforms use adler32(data) & 0xffffffff. If you are only using the checksum in packed binary format this is not necessary as the return value is the correct 32bit binary representation regardless of sign.
Compression objects support the following methods:
Decompression objects support the following methods and attributes:
Information about the version of the zlib library in use is available through the following constants: