The procedures in
(weinholt compression inflate) decompress
DEFLATE data streams. DEFLATE is the data format used by gzip, zip and
zlib. This library handles the raw data stream.
Inflates a complete DEFLATE data stream. It reads compressed data from binary-input-port and writes decompressed data to binary-output-port.
Three values are returned: the final CRC of the decompressed data, its length, and a bytevector with read but unused bytes from the input.
Returns a procedure that, when called, decompresses a DEFLATE block from binary-input-port. The returned procedure should be called with zero arguments and returns either the symbol
done, to signify the end of the DEFLATE stream, or
moreto indicate more blocks are (or will be) available.
For a description of the sink argument, see compression sliding-buffer.
The window-size is the size of the sliding window buffer. The most common value is 32*1024 bytes, but each DEFLATE stream has a correct value that was used when creating the stream. For zlib streams this value is specified in the header.
The dictionary is a bytevector that is prepended to the output buffer, but it is not actually copied to the output. See compression zlib.
The inflate algorithm needs some lookahead and therefore it can read a byte or two that does not belong to the inflate stream itself. Apply the symbol
get-bufferto the returned procedure to recover those extra bytes as a bytevector.
(0 0)– Initial version
inflatereturns three values (backwards incompatible change). The inflater procedures gain a way to return any buffered bytes.