.TH zlib 3erl "erts 13.2.2.8" "Ericsson AB" "Erlang Module Definition" .SH NAME zlib \- zlib compression interface. .SH DESCRIPTION .LP This module provides an API for the zlib library (www\&.zlib\&.net)\&. It is used to compress and decompress data\&. The data format is described by RFC 1950, RFC 1951, and RFC 1952\&. .LP A typical (compress) usage is as follows: .LP .nf Z = zlib:open(), ok = zlib:deflateInit(Z,default), Compress = fun(end_of_data, _Cont) -> []; (Data, Cont) -> [zlib:deflate(Z, Data)|Cont(Read(),Cont)] end, Compressed = Compress(Read(),Compress), Last = zlib:deflate(Z, [], finish), ok = zlib:deflateEnd(Z), zlib:close(Z), list_to_binary([Compressed|Last]) .fi .LP In all functions errors, \fI{\&'EXIT\&',{Reason,Backtrace}}\fR\&, can be thrown, where \fIReason\fR\& describes the error\&. .LP Typical \fIReason\fR\&s: .RS 2 .TP 2 .B \fIbadarg\fR\&: Bad argument\&. .TP 2 .B \fInot_initialized\fR\&: The stream hasn\&'t been initialized, eg\&. if \fIinflateInit/1\fR\& wasn\&'t called prior to a call to \fIinflate/2\fR\&\&. .TP 2 .B \fInot_on_controlling_process\fR\&: The stream was used by a process that doesn\&'t control it\&. Use \fIset_controlling_process/2\fR\& if you need to transfer a stream to a different process\&. .TP 2 .B \fIdata_error\fR\&: The data contains errors\&. .TP 2 .B \fIstream_error\fR\&: Inconsistent stream state\&. .TP 2 .B \fI{need_dictionary,Adler32}\fR\&: See \fIinflate/2\fR\&\&. .RE .SH DATA TYPES .nf \fBzstream()\fR\& = reference() .br .fi .RS .LP A zlib stream, see \fIopen/0\fR\&\&. .RE .nf \fBzlevel()\fR\& = .br none | default | best_compression | best_speed | 0\&.\&.9 .br .fi .nf \fBzflush()\fR\& = none | sync | full | finish .br .fi .nf \fBzmemlevel()\fR\& = 1\&.\&.9 .br .fi .nf \fBzmethod()\fR\& = deflated .br .fi .nf \fBzstrategy()\fR\& = default | filtered | huffman_only | rle .br .fi .nf \fBzwindowbits()\fR\& = -15\&.\&.-8 | 8\&.\&.47 .br .fi .RS .LP Normally in the range \fI-15\&.\&.-8 | 8\&.\&.15\fR\&\&. .RE .SH EXPORTS .LP .nf .B adler32(Z, Data) -> CheckSum .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br CheckSum = integer() >= 0 .br .RE .RE .RS .LP Calculates the Adler-32 checksum for \fIData\fR\&\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:adler32/1\fR\& instead\&. .RE .LP .nf .B adler32(Z, PrevAdler, Data) -> CheckSum .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br PrevAdler = integer() >= 0 .br Data = iodata() .br CheckSum = integer() >= 0 .br .RE .RE .RS .LP Updates a running Adler-32 checksum for \fIData\fR\&\&. If \fIData\fR\& is the empty binary or the empty iolist, this function returns the required initial value for the checksum\&. .LP Example: .LP .nf Crc = lists:foldl(fun(Data,Crc0) -> zlib:adler32(Z, Crc0, Data), end, zlib:adler32(Z,<< >>), Datas) .fi .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:adler32/2\fR\& instead\&. .RE .LP .nf .B adler32_combine(Z, Adler1, Adler2, Size2) -> Adler .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Adler = Adler1 = Adler2 = Size2 = integer() >= 0 .br .RE .RE .RS .LP Combines two Adler-32 checksums into one\&. For two binaries or iolists, \fIData1\fR\& and \fIData2\fR\& with sizes of \fISize1\fR\& and \fISize2\fR\&, with Adler-32 checksums \fIAdler1\fR\& and \fIAdler2\fR\&\&. .LP This function returns the \fIAdler\fR\& checksum of \fI[Data1,Data2]\fR\&, requiring only \fIAdler1\fR\&, \fIAdler2\fR\&, and \fISize2\fR\&\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:adler32_combine/3\fR\& instead\&. .RE .LP .nf .B close(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Closes the stream referenced by \fIZ\fR\&\&. .RE .LP .nf .B compress(Data) -> Compressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Compressed = binary() .br .RE .RE .RS .LP Compresses data with zlib headers and checksum\&. .RE .LP .nf .B crc32(Z) -> CRC .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br CRC = integer() >= 0 .br .RE .RE .RS .LP Gets the current calculated CRC checksum\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:crc32/1\fR\& on the uncompressed data instead\&. .RE .LP .nf .B crc32(Z, Data) -> CRC .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br CRC = integer() >= 0 .br .RE .RE .RS .LP Calculates the CRC checksum for \fIData\fR\&\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:crc32/1\fR\& instead\&. .RE .LP .nf .B crc32(Z, PrevCRC, Data) -> CRC .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br PrevCRC = integer() >= 0 .br Data = iodata() .br CRC = integer() >= 0 .br .RE .RE .RS .LP Updates a running CRC checksum for \fIData\fR\&\&. If \fIData\fR\& is the empty binary or the empty iolist, this function returns the required initial value for the CRC\&. .LP Example: .LP .nf Crc = lists:foldl(fun(Data,Crc0) -> zlib:crc32(Z, Crc0, Data), end, zlib:crc32(Z,<< >>), Datas) .fi .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:crc32/2\fR\& instead\&. .RE .LP .nf .B crc32_combine(Z, CRC1, CRC2, Size2) -> CRC .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br CRC = CRC1 = CRC2 = Size2 = integer() >= 0 .br .RE .RE .RS .LP Combines two CRC checksums into one\&. For two binaries or iolists, \fIData1\fR\& and \fIData2\fR\& with sizes of \fISize1\fR\& and \fISize2\fR\&, with CRC checksums \fICRC1\fR\& and \fICRC2\fR\&\&. .LP This function returns the \fICRC\fR\& checksum of \fI[Data1,Data2]\fR\&, requiring only \fICRC1\fR\&, \fICRC2\fR\&, and \fISize2\fR\&\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIerlang:crc32_combine/3\fR\& instead\&. .RE .LP .nf .B deflate(Z, Data) -> Compressed .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Compressed = iolist() .br .RE .RE .RS .LP Same as \fIdeflate(Z, Data, none)\fR\&\&. .RE .LP .nf .B deflate(Z, Data, Flush) -> Compressed .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Flush = zflush() .br Compressed = iolist() .br .RE .RE .RS .LP Compresses as much data as possible, and stops when the input buffer becomes empty\&. It can introduce some output latency (reading input without producing any output) except when forced to flush\&. .LP If \fIFlush\fR\& is set to \fIsync\fR\&, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far\&. Flushing can degrade compression for some compression algorithms; thus, use it only when necessary\&. .LP If \fIFlush\fR\& is set to \fIfull\fR\&, all output is flushed as with \fIsync\fR\&, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired\&. Using \fIfull\fR\& too often can seriously degrade the compression\&. .LP If \fIFlush\fR\& is set to \fIfinish\fR\&, pending input is processed, pending output is flushed, and \fIdeflate/3\fR\& returns\&. Afterwards the only possible operations on the stream are \fIdeflateReset/1\fR\& or \fIdeflateEnd/1\fR\&\&. .LP \fIFlush\fR\& can be set to \fIfinish\fR\& immediately after \fIdeflateInit\fR\& if all compression is to be done in one step\&. .LP Example: .LP .nf zlib:deflateInit(Z), B1 = zlib:deflate(Z,Data), B2 = zlib:deflate(Z,<< >>,finish), zlib:deflateEnd(Z), list_to_binary([B1,B2]) .fi .RE .LP .nf .B deflateEnd(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Ends the deflate session and cleans all data used\&. Notice that this function throws a \fIdata_error\fR\& exception if the last call to \fIdeflate/3\fR\& was not called with \fIFlush\fR\& set to \fIfinish\fR\&\&. .RE .LP .nf .B deflateInit(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Same as \fIzlib:deflateInit(Z, default)\fR\&\&. .RE .LP .nf .B deflateInit(Z, Level) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Level = zlevel() .br .RE .RE .RS .LP Initializes a zlib stream for compression\&. .LP \fILevel\fR\& decides the compression level to be used: .RS 2 .TP 2 * \fIdefault\fR\& gives default compromise between speed and compression .LP .TP 2 * \fInone\fR\& (0) gives no compression .LP .TP 2 * \fIbest_speed\fR\& (1) gives best speed .LP .TP 2 * \fIbest_compression\fR\& (9) gives best compression .LP .RE .RE .LP .nf .B deflateInit(Z, Level, Method, WindowBits, MemLevel, Strategy) -> .B ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Level = zlevel() .br Method = zmethod() .br WindowBits = zwindowbits() .br MemLevel = zmemlevel() .br Strategy = zstrategy() .br .RE .RE .RS .LP Initiates a zlib stream for compression\&. .RS 2 .TP 2 .B \fILevel\fR\&: Compression level to use: .RS 2 .TP 2 * \fIdefault\fR\& gives default compromise between speed and compression .LP .TP 2 * \fInone\fR\& (0) gives no compression .LP .TP 2 * \fIbest_speed\fR\& (1) gives best speed .LP .TP 2 * \fIbest_compression\fR\& (9) gives best compression .LP .RE .TP 2 .B \fIMethod\fR\&: Compression method to use, currently the only supported method is \fIdeflated\fR\&\&. .TP 2 .B \fIWindowBits\fR\&: The base two logarithm of the window size (the size of the history buffer)\&. It is to be in the range 8 through 15\&. Larger values result in better compression at the expense of memory usage\&. Defaults to 15 if \fIdeflateInit/2\fR\& is used\&. A negative \fIWindowBits\fR\& value suppresses the zlib header (and checksum) from the stream\&. Notice that the zlib source mentions this only as a undocumented feature\&. .LP .RS -4 .B Warning: .RE Due to a known bug in the underlying zlib library, \fIWindowBits\fR\& values 8 and -8 do not work as expected\&. In zlib versions before 1\&.2\&.9 values 8 and -8 are automatically changed to 9 and -9\&. \fIFrom zlib version 1\&.2\&.9 value -8 is rejected\fR\& causing \fIzlib:deflateInit/6\fR\& to fail (8 is still changed to 9)\&. It also seem possible that future versions of zlib may fix this bug and start accepting 8 and -8 as is\&. .LP Conclusion: Avoid values 8 and -8 unless you know your zlib version supports them\&. .TP 2 .B \fIMemLevel\fR\&: Specifies how much memory is to be allocated for the internal compression state: \fIMemLevel\fR\&=1 uses minimum memory but is slow and reduces compression ratio; \fIMemLevel\fR\&=9 uses maximum memory for optimal speed\&. Defaults to 8\&. .TP 2 .B \fIStrategy\fR\&: Tunes the compression algorithm\&. Use the following values: .RS 2 .TP 2 * \fIdefault\fR\& for normal data .LP .TP 2 * \fIfiltered\fR\& for data produced by a filter (or predictor) .LP .TP 2 * \fIhuffman_only\fR\& to force Huffman encoding only (no string match) .LP .TP 2 * \fIrle\fR\& to limit match distances to one (run-length encoding) .LP .RE .RS 2 .LP Filtered data consists mostly of small values with a somewhat random distribution\&. In this case, the compression algorithm is tuned to compress them better\&. The effect of \fIfiltered\fR\& is to force more Huffman coding and less string matching; it is somewhat intermediate between \fIdefault\fR\& and \fIhuffman_only\fR\&\&. \fIrle\fR\& is designed to be almost as fast as \fIhuffman_only\fR\&, but gives better compression for PNG image data\&. .RE .RS 2 .LP \fIStrategy\fR\& affects only the compression ratio, but not the correctness of the compressed output even if it is not set appropriately\&. .RE .RE .RE .LP .nf .B deflateParams(Z, Level, Strategy) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Level = zlevel() .br Strategy = zstrategy() .br .RE .RE .RS .LP Dynamically updates the compression level and compression strategy\&. The interpretation of \fILevel\fR\& and \fIStrategy\fR\& is as in \fIdeflateInit/6\fR\&\&. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy\&. If the compression level is changed, the input available so far is compressed with the old level (and can be flushed); the new level takes effect only at the next call of \fIdeflate/3\fR\&\&. .LP Before the call of \fIdeflateParams\fR\&, the stream state must be set as for a call of \fIdeflate/3\fR\&, as the currently available input may have to be compressed and flushed\&. .RE .LP .nf .B deflateReset(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Equivalent to \fIdeflateEnd/1\fR\& followed by \fIdeflateInit/1,2,6\fR\&, but does not free and reallocate all the internal compression state\&. The stream keeps the same compression level and any other attributes\&. .RE .LP .nf .B deflateSetDictionary(Z, Dictionary) -> Adler32 .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Dictionary = iodata() .br Adler32 = integer() >= 0 .br .RE .RE .RS .LP Initializes the compression dictionary from the specified byte sequence without producing any compressed output\&. .LP This function must be called immediately after \fIdeflateInit/1,2,6\fR\& or \fIdeflateReset/1\fR\&, before any call of \fIdeflate/3\fR\&\&. .LP The compressor and decompressor must use the same dictionary (see \fIinflateSetDictionary/2\fR\&)\&. .LP The Adler checksum of the dictionary is returned\&. .RE .LP .nf .B getBufSize(Z) -> integer() >= 0 .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Gets the size of the intermediate buffer\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. .RE .LP .nf .B gunzip(Data) -> Decompressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Decompressed = binary() .br .RE .RE .RS .LP Uncompresses data with gz headers and checksum\&. .RE .LP .nf .B gzip(Data) -> Compressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Compressed = binary() .br .RE .RE .RS .LP Compresses data with gz headers and checksum\&. .RE .LP .nf .B inflate(Z, Data) -> Decompressed .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Decompressed = iolist() .br .RE .RE .RS .LP Equivalent to \fIinflate(Z, Data, [])\fR\& .RE .LP .nf .B inflate(Z, Data, Options) -> Decompressed .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Options = [{exception_on_need_dict, boolean()}] .br Decompressed = .br iolist() | .br {need_dictionary, .br Adler32 :: integer() >= 0, .br Output :: iolist()} .br .RE .RE .RS .LP Decompresses as much data as possible\&. It can introduce some output latency (reading input without producing any output)\&. .LP Currently the only available option is \fI{exception_on_need_dict,boolean()}\fR\& which controls whether the function should throw an exception when a preset dictionary is required for decompression\&. When set to false, a \fIneed_dictionary\fR\& tuple will be returned instead\&. See \fIinflateSetDictionary/2\fR\& for details\&. .LP .RS -4 .B Warning: .RE This option defaults to \fItrue\fR\& for backwards compatibility but we intend to remove the exception behavior in a future release\&. New code that needs to handle dictionaries manually should always specify \fI{exception_on_need_dict,false}\fR\&\&. .RE .LP .nf .B inflateChunk(Z) -> Decompressed | {more, Decompressed} .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Decompressed = iolist() .br .RE .RE .RS .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIsafeInflate/2\fR\& instead\&. .LP Reads the next chunk of uncompressed data, initialized by \fIinflateChunk/2\fR\&\&. .LP This function is to be repeatedly called, while it returns \fI{more, Decompressed}\fR\&\&. .RE .LP .nf .B inflateChunk(Z, Data) -> Decompressed | {more, Decompressed} .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Decompressed = iolist() .br .RE .RE .RS .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. Use \fIsafeInflate/2\fR\& instead\&. .LP Like \fIinflate/2\fR\&, but decompresses no more data than will fit in the buffer configured through \fIsetBufSize/2\fR\&\&. Is is useful when decompressing a stream with a high compression ratio, such that a small amount of compressed input can expand up to 1000 times\&. .LP This function returns \fI{more, Decompressed}\fR\&, when there is more output available, and \fIinflateChunk/1\fR\& is to be used to read it\&. .LP This function can introduce some output latency (reading input without producing any output)\&. .LP An exception will be thrown if a preset dictionary is required for further decompression\&. See \fIinflateSetDictionary/2\fR\& for details\&. .LP Example: .LP .nf walk(Compressed, Handler) -> Z = zlib:open(), zlib:inflateInit(Z), % Limit single uncompressed chunk size to 512kb zlib:setBufSize(Z, 512 * 1024), loop(Z, Handler, zlib:inflateChunk(Z, Compressed)), zlib:inflateEnd(Z), zlib:close(Z). loop(Z, Handler, {more, Uncompressed}) -> Handler(Uncompressed), loop(Z, Handler, zlib:inflateChunk(Z)); loop(Z, Handler, Uncompressed) -> Handler(Uncompressed). .fi .RE .LP .nf .B inflateEnd(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Ends the inflate session and cleans all data used\&. Notice that this function throws a \fIdata_error\fR\& exception if no end of stream was found (meaning that not all data has been uncompressed)\&. .RE .LP .nf .B inflateGetDictionary(Z) -> Dictionary .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Dictionary = binary() .br .RE .RE .RS .LP Returns the decompression dictionary currently in use by the stream\&. This function must be called between \fIinflateInit/1,2\fR\& and \fIinflateEnd\fR\&\&. .LP Only supported if ERTS was compiled with zlib >= 1\&.2\&.8\&. .RE .LP .nf .B inflateInit(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Initializes a zlib stream for decompression\&. .RE .LP .nf .B inflateInit(Z, WindowBits) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br WindowBits = zwindowbits() .br .RE .RE .RS .LP Initializes a decompression session on zlib stream\&. .LP \fIWindowBits\fR\& is the base two logarithm of the maximum window size (the size of the history buffer)\&. It is to be in the range 8 through 15\&. Default to 15 if \fIinflateInit/1\fR\& is used\&. .LP If a compressed stream with a larger window size is specified as input, \fIinflate/2\fR\& throws the \fIdata_error\fR\& exception\&. .LP A negative \fIWindowBits\fR\& value makes zlib ignore the zlib header (and checksum) from the stream\&. Notice that the zlib source mentions this only as a undocumented feature\&. .RE .LP .nf .B inflateReset(Z) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br .RE .RE .RS .LP Equivalent to \fIinflateEnd/1\fR\& followed by \fIinflateInit/1\fR\&, but does not free and reallocate all the internal decompression state\&. The stream will keep attributes that could have been set by \fIinflateInit/1,2\fR\&\&. .RE .LP .nf .B inflateSetDictionary(Z, Dictionary) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Dictionary = iodata() .br .RE .RE .RS .LP Initializes the decompression dictionary from the specified uncompressed byte sequence\&. This function must be called as a response to an inflate operation (eg\&. \fIsafeInflate/2\fR\&) returning \fI{need_dictionary,Adler,Output}\fR\& or in the case of deprecated functions, throwing an \fI{\&'EXIT\&',{{need_dictionary,Adler},_StackTrace}}\fR\& exception\&. .LP The dictionary chosen by the compressor can be determined from the Adler value returned or thrown by the call to the inflate function\&. The compressor and decompressor must use the same dictionary (See \fIdeflateSetDictionary/2\fR\&)\&. .LP After setting the dictionary the inflate operation should be retried without new input\&. .LP Example: .LP .nf deprecated_unpack(Z, Compressed, Dict) -> case catch zlib:inflate(Z, Compressed) of {'EXIT',{{need_dictionary,_DictID},_}} -> ok = zlib:inflateSetDictionary(Z, Dict), Uncompressed = zlib:inflate(Z, []); Uncompressed -> Uncompressed end. new_unpack(Z, Compressed, Dict) -> case zlib:inflate(Z, Compressed, [{exception_on_need_dict, false}]) of {need_dictionary, _DictId, Output} -> ok = zlib:inflateSetDictionary(Z, Dict), [Output | zlib:inflate(Z, [])]; Uncompressed -> Uncompressed end. .fi .RE .LP .nf .B open() -> zstream() .br .fi .br .RS .LP Opens a zlib stream\&. .RE .LP .nf .B safeInflate(Z, Data) -> Result .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Data = iodata() .br Result = .br {continue, Output :: iolist()} | .br {finished, Output :: iolist()} | .br {need_dictionary, .br Adler32 :: integer() >= 0, .br Output :: iolist()} .br .RE .RE .RS .LP Like \fIinflate/2\fR\&, but returns once it has expanded beyond a small implementation-defined threshold\&. It\&'s useful when decompressing untrusted input which could have been maliciously crafted to expand until the system runs out of memory\&. .LP This function returns \fI{continue | finished, Output}\fR\&, where Output is the data that was decompressed in this call\&. New input can be queued up on each call if desired, and the function will return \fI{finished, Output}\fR\& once all queued data has been decompressed\&. .LP This function can introduce some output latency (reading input without producing any output)\&. .LP If a preset dictionary is required for further decompression, this function returns a \fIneed_dictionary\fR\& tuple\&. See \fIinflateSetDictionary/2\fR\&) for details\&. .LP Example: .LP .nf walk(Compressed, Handler) -> Z = zlib:open(), zlib:inflateInit(Z), loop(Z, Handler, zlib:safeInflate(Z, Compressed)), zlib:inflateEnd(Z), zlib:close(Z). loop(Z, Handler, {continue, Output}) -> Handler(Output), loop(Z, Handler, zlib:safeInflate(Z, [])); loop(Z, Handler, {finished, Output}) -> Handler(Output). .fi .RE .LP .nf .B setBufSize(Z, Size) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Size = integer() >= 0 .br .RE .RE .RS .LP Sets the intermediate buffer size\&. .LP .RS -4 .B Warning: .RE This function is deprecated and will be removed in a future release\&. .RE .LP .nf .B set_controlling_process(Z, Pid) -> ok .br .fi .br .RS .LP Types: .RS 3 Z = zstream() .br Pid = pid() .br .RE .RE .RS .LP Changes the controlling process of \fIZ\fR\& to \fIPid\fR\&, which must be a local process\&. .RE .LP .nf .B uncompress(Data) -> Decompressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Decompressed = binary() .br .RE .RE .RS .LP Uncompresses data with zlib headers and checksum\&. .RE .LP .nf .B unzip(Data) -> Decompressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Decompressed = binary() .br .RE .RE .RS .LP Uncompresses data without zlib headers and checksum\&. .RE .LP .nf .B zip(Data) -> Compressed .br .fi .br .RS .LP Types: .RS 3 Data = iodata() .br Compressed = binary() .br .RE .RE .RS .LP Compresses data without zlib headers and checksum\&. .RE