uzlib – zlib decompression

This module implements a subset of the corresponding CPython module, as described below. For more information, please refer to the original CPython documentation: zlib

This module allows decompressing binary data compressed with the DEFLATE algorithm (commonly used by the zlib library and gzip compression programs). Compression is not yet implemented.

Functions

uzlib.decompress(data, wbits=0, bufsize=0)

Return the decompressed data as bytes. wbits is the DEFLATE dictionary window size used during compression (8-15; the dictionary size is 2 to the power of this value). In addition, if this value is positive, data is assumed to be a zlib stream (with a zlib header). Otherwise, if the value is negative, it is assumed to be a raw DEFLATE stream. The bufsize parameter is for compatibility with CPython and is ignored here.

class uzlib.DecompIO(stream, wbits=0)

Create a stream decorator that allows transparent decompression of compressed data in another stream. This allows processing a compressed stream using data larger than the available heap size. In addition to the values described in decompress(), wbits can take the value 24..31 (16 + 8..15), which means the input stream has a gzip header.

Differences from CPython

This class is a MicroPython extension. Use it with caution; it may undergo major changes or be removed in later versions.