IPWorks ZIP 2020 Python Edition

Questions / Feedback?

Gzip Class

Properties   Methods   Events   Configuration Settings   Errors  

The Gzip class implements a gzip compressor and decompressor. It is compliant with RFC 1952 and compatible with the UNIX gzip and gunzip utilities.


class ipworkszip.Gzip


The gzip file format is typically used only to archive a single file. Accordingly, the operation of the class is simpler than that of the other classs.

To compress with the class, set archive_file to the name of the gzip file to be created, and file_decompressed_name to the name of the file to be compressed. Finally, invoke compress. To extract the file, first set archive_file. file_decompressed_name may then be set; if not, it will automatically be set from the gzip file headers. Finally, invoke the extract or compress method.

.tar.gz files may be created or extracted in one step by using the Tar class. See the documentation for Tar for more details.

Example (Creating a Gzip File)

ZipControl.ArchiveFile = "c:\test.gz"
ZipControl.FileDecompressedName = "c:\test.txt"
Example (Extracting from a Gzip File)

ZipControl.ArchiveFile = "c:\test.gz"
ZipControl.FileDecompressedName = "c:\test.txt"

Property List

The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

archive_fileThe name of the zip, gzip, tar, or jar archive.
compression_levelThe compression level to use.
compression_methodThe compression method for the class to use.
extract_to_pathA base path to decompress to.
file_compressed_dateThe date and time of the compressed file, as stored within the gzip archive.
file_compressed_nameFilename, as stored inside of the archive.
file_decompressed_nameFile name to decompress to, or compress from.
file_decompressed_sizeGets the size of the file, as decompressed outside the archive.
file_input_dataThe data of the file to be compressed.
gzip_data(Decompression only) The gzip file contents as a byte array.
has_more_dataShows whether or not there is more data in the gzip archive.

Method List

The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

abortAborts the current operation.
appendAdds specified file to an existing archive.
compressCreates the compressed gzip archive.
configSets or retrieves a configuration setting.
extractExtracts the compressed file from the gzip archive.
extract_allExtracts all files from the compressed archive.
resetResets the class.
scanScans the compressed archive.

Event List

The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_begin_fileFired before a file is processed.
on_end_fileFired after a file is processed.
on_errorInformation about non-fatal errors.
on_overwriteFired whenever a file exists and may be overwritten.
on_progressFired as progress is made.

Configuration Settings

The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

FileCommentHolds the comment associated with the archive.
PreserveModifiedTimeWhether or not to preserve the original modified time on extracted files.
WriteToProgressEventWhether or not to write data to the Progress Event.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks ZIP 2020 Python Edition - Version 20.0 [Build 7720]