zlib.decompress_head

zlib

decompress_head(data, n) -> head, err

Decompress the first bytes of zlib-wrapped data

Returns at most n bytes from the start of the output, for a header read without inflating the whole stream. A stream longer than n is no error, and input cut after n bytes of output is none either: the rest of the stream is not read, and its adler32 trailer is not checked. A stream shorter than n returns its whole output. Input that ends before both the stream and n bytes returns nil and "truncated stream". An n under 1 returns "".