uzlib.rst 1.4 KB

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