|
6 | 6 |
|
7 | 7 | |see_cpython_module| :mod:`python:zlib`. |
8 | 8 |
|
9 | | -This modules allows to decompress binary data compressed with DEFLATE |
10 | | -algorithm (commonly used in zlib library and gzip archiver). Compression |
| 9 | +This module allows to decompress binary data compressed with |
| 10 | +`DEFLATE algorithm <https://en.wikipedia.org/wiki/DEFLATE>`_ |
| 11 | +(commonly used in zlib library and gzip archiver). Compression |
11 | 12 | is not yet implemented. |
12 | 13 |
|
13 | 14 | Functions |
14 | 15 | --------- |
15 | 16 |
|
16 | | -.. function:: decompress(data) |
| 17 | +.. function:: decompress(data, wbits=0, bufsize=0) |
17 | 18 |
|
18 | | - Return decompressed data as bytes. |
| 19 | + Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window |
| 20 | + size used during compression (8-15, the dictionary size is power of 2 of |
| 21 | + that value). Additionally, if value is positive, *data* is assumed to be |
| 22 | + zlib stream (with zlib header). Otherwise, if it's negative, it's assumed |
| 23 | + to be raw DEFLATE stream. *bufsize* parameter is for compatibility with |
| 24 | + CPython and is ignored. |
| 25 | + |
| 26 | +.. class:: DecompIO(stream, wbits=0) |
| 27 | + |
| 28 | + Create a stream wrapper which allows transparent decompression of |
| 29 | + compressed data in another *stream*. This allows to process compressed |
| 30 | + streams with data larger than available heap size. In addition to |
| 31 | + values described in :func:`decompress`, *wbits* may take values |
| 32 | + 24..31 (16 + 8..15), meaning that input stream has gzip header. |
| 33 | + |
| 34 | + .. admonition:: Difference to CPython |
| 35 | + :class: attention |
| 36 | + |
| 37 | + This class is MicroPython extension. It's included on provisional |
| 38 | + basis and may be changed considerably or removed in later versions. |
0 commit comments