Zlib::GzipFile is an abstract class for handling a gzip formatted compressed file. The operations are defined in the subclasses, Zlib::GzipReader for reading, and Zlib::GzipWriter for writing.

GzipReader should be used by associating an IO, or IO-like, object.

Method Catalogue

(due to internal structure, documentation may appear under Zlib::GzipReader or Zlib::GzipWriter)

Class Methods

Creates a GzipReader or GzipWriter associated with io, passing in any necessary extra options, and executes the block with the newly created object just like File.open.

The GzipFile object will be closed automatically after executing the block. If you want to keep the associated IO object open, you may call Zlib::GzipFile#finish method in the block.

Instance Methods

Closes the GzipFile object. This method calls close method of the associated IO object. Returns the associated IO object.

Same as IO#closed?

Returns comments recorded in the gzip file header, or nil if the comments is not present.

Returns CRC value of the uncompressed data.

Closes the GzipFile object. Unlike Zlib::GzipFile#close, this method never calls the close method of the associated IO object. Returns the associated IO object.

Returns compression level.

Returns last modification time recorded in the gzip file header.

Returns original filename recorded in the gzip file header, or nil if original filename is not present.

Returns OS code number recorded in the gzip file header.

Same as IO#sync

Same as IO. If flag is true, the associated IO object must respond to the flush method. While sync mode is true, the compression ratio decreases sharply.

Same as IO.