on_before_compress_file Event
Marks the start of compression of a file.
Syntax
class ArchiveWriterBeforeCompressFileEventParams(object): @property def path() -> str: ... @property def file_size() -> int: ... @property def data_source() -> int: ... # In class ArchiveWriter: @property def on_before_compress_file() -> Callable[[ArchiveWriterBeforeCompressFileEventParams], None]: ... @on_before_compress_file.setter def on_before_compress_file(event_hook: Callable[[ArchiveWriterBeforeCompressFileEventParams], None]) -> None: ...
Remarks
Subscribe to this event to be notified about the start of compression of an archive entry. The handler of this event is a good place to prepare the desired data source.
The Path parameter indicates the path to the extracted entry in the archive. The FileSize specifies the size of the file before compression. Use this event handler to adjust the data source if the file is to be loaded from a stream or buffer. The DataSource parameter indicates the type of the data media:
fdsFile (0) | The data will be taken from a file indicated by the entry's LocalPath setting. You can change this path in the handler of this event. |
fdsStream (1) | The file data will be taken from a stream assigned to file_stream property. |
fdsBuffer (2) | The data will be taken from a buffer attached to the file_data property. |
Use on_prepare_file event to adjust the file data source on the fly.