Pike v8.1 release 6

Method Gz.inflate()->create()


Method create

Gz.inflate Gz.inflate(int|void window_size)
Gz.inflate Gz.inflate(mapping options)

Description

If called with a mapping as only argument, create accepts the entries window_size (described below) and dictionary, which is a string to be set as dictionary.

The window_size value is passed down to inflateInit2 in zlib.

If the argument is negative, no header checks are done, and no verification of the data will be done either. This is needed for uncompressing ZIP-files, as an example. The negative value is then negated, and handled as a positive value.

Positive arguments set the maximum dictionary size to an exponent of 2, such that 8 (the minimum) will cause the window size to be 256, and 15 (the maximum, and default value) will cause it to be 32Kb. Setting this to anything except 15 is rather pointless in Pike.

It can be used to limit the amount of memory that is used to uncompress files, but 32Kb is not all that much in the great scheme of things.

To decompress files compressed with level 9 compression, a 32Kb window size is needed. level 1 compression only requires a 256 byte window.

If the options version is used you can specify your own dictionary in addition to the window size.

dictionary : string
window_size : int