On this page
zlib.decompressobj
Prev: zlib.decompress | Up: zlib | Next: zlib.error
Rel: zlib.adler32, zlib.compress, zlib.compressobj, zlib.crc32
Ref: docs.python.org — zlib.decompressobj
Tags: #public #python3 #stdlib #zlib
Import
import zlib
from zlib import decompressobj
Signature & Overview
zlib.decompressobj(wbits=15, zdict=b'')
Return a decompressor object.
Usage
import zlib
blob = zlib.compress(b'a' * 1000)
d = zlib.decompressobj()
first = d.decompress(blob, max_length=100)
assert len(first) == 100 and len(d.unconsumed_tail) > 0
Gotchas
- Pass
max_length=on untrusted data and draind.unconsumed_tailin bounded chunks.
REPL Inspect
from zlib import decompressobj
help(decompressobj)
Linked from
Related notes
- tuts/python3/stdlib_module/zlib/decompress Linked here; links to this page; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/error 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/adler32 Linked here; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/compress Linked here; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/compressobj Linked here; shared tags: #stdlib, #zlib
- tuts/python3/stdlib_module/zlib/crc32 Linked here; 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