Next: , Previous: compression adler-32, Up: compression


2.2.2 GZIP custom input port

The (weinholt compression gzip) library provides a custom input port for reading GZIP compressed data.

A word of warning: the current implementation uses an internal buffer that can grow big when reading specially crafted data.

The GZIP format can support multiple compression methods, but only DEFLATE'd data is supported in this library.

— Procedure: is-gzip-file? filename-or-port

Takes a filename or a binary input port and returns true if the file looks like a GZIP file. The port should have set-port-position! and port-position.

— Procedure: make-gzip-input-port binary-input-port id close-underlying-port?

Returns a new port that can be used to read decompressed GZIP data from the binary-input-port. The id is the name of the returned port.

If close-underlying-port? is true then at the end of the GZIP stream the binary-input-port will be closed.

— Procedure: open-gzip-file-input-port filename

Opens the file specified by filename and returns a binary input port that decompresses the file on-the-fly.

— Procedure: extract-gzip binary-input-port binary-output-port

Reads compressed data from binary-input-port and writes the decompressed data to binary-output-port. Returns a list of gzip headers, one for each gzip member of the file (gzip files can be concatenated).

— Procedure: get-gzip-header binary-input-port

Reads a GZIP header from binary-input-port and performs sanity checks.

See RFC 1952 for a full description of the following values. Updates are available at http://www.gzip.org/format.txt.

— Procedure: gzip-text? hdr

True if the uncompressed data associated with hdr is believed to be text.

— Procedure: gzip-mtime hdr

The file's modification time as an SRFI-19 date or #f is none is available.

— Procedure: gzip-extra-data hdr

An “extra field” which some systems use to encode additional file attributes. This is an unparsed bytevector.

— Procedure: gzip-filename hdr

The file's original filename as a string or #f if none is available.

— Procedure: gzip-comment hdr

A file comment as a string or #f if none is available.

— Procedure: gzip-method hdr

The symbol slowest, fastest or an integer (probably denoting a different compression setting).

— Procedure: gzip-os hdr

The id number of the operating system that created the file. It is e.g. 0 for DOS, 1 for Amiga, 2 for VMS, 3 for Unix.

Version history: