On this page
zlib.decompress
Prev: zlib.crc32 | Up: zlib | Next: zlib.decompressobj
Rel: zlib.adler32, zlib.compress, zlib.compressobj, zlib.crc32
Ref: docs.python.org — zlib.decompress
Tags: #public #python3 #stdlib #zlib
Import
import zlib
from zlib import decompress
Signature & Overview
zlib.decompress(data, /, wbits=15, bufsize=16384)
Returns a bytes object containing the uncompressed data.
Usage
import zlib
assert zlib.decompress(zlib.compress(b'payload')) == b'payload'
Gotchas
- Vulnerable to zip-bombs on untrusted input: Use
decompressobj().decompress(chunk, max_length=...)for untrusted streams.
REPL Inspect
from zlib import decompress
help(decompress)
Linked from
Related notes
- tuts/python3/stdlib_module/zlib/adler32 Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/compress Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/compressobj Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/crc32 Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/decompressobj Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/zlib/error shared tags: #stdlib, #zlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib