IPWorks ZIP 2020 Python Edition

Questions / Feedback?

compress Method

Creates the compressed archive.

Syntax

def compress() -> None: ...

Remarks

Invoking compress creates the archive specified by archive_file. When the method is called, all files specified by the file_decompressed_name field of the files collection will be compressed and written to archive_file.

The compressed data may be streamed out by setting WriteToProgressEvent to true. If streaming is enabled the compressed data will also be provided via the on_progress event. If archive_file is set to an empty string the archive will be written only to this event.

The files to compress are specified in the files collection. The file names are specified by file_compressed_name and file_decompressed_name. These should be specified before invoking compress, either manually or by invoking include_files.

The on_begin_file and on_end_file events will be fired as files are processed, and the on_progress event will be fired as data is compressed.

Existing files will be overwritten by the class if overwrite_files is set to true. Finer control over which files are overwritten may be gained by trapping the on_overwrite event.

Example (Creating an Archive)


ZipControl.ArchiveFile = "c:\test.zip"
ZipControl.RecurseSubdirectories = true
ZipControl.IncludeFiles("c:\foo\*")
ZipControl.Compress()

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