ZlibCompressor#
Superclasses: Object
Implemented Interfaces: Converter
GZlibCompressor is an implementation of Converter that
compresses data using zlib.
Constructors#
- class ZlibCompressor
- classmethod new(format: ZlibCompressorFormat, level: int) ZlibCompressor#
Creates a compressor.
Added in version 2.24.
- Parameters:
format – the format to use for the compressed data
level – compression level (
0-9),-1for default
Methods#
- class ZlibCompressor
-
- set_file_info(file_info: FileInfo | None = None) None#
Sets the
file_infoproperty.Note: it is an error to call this function while a compression is in progress; it may only be called immediately after creation of
compressor, or after resetting it withreset.Added in version 2.26.
- Parameters:
file_info – file info for the gzip header
Properties#
- class ZlibCompressor
- props.file_info: FileInfo#
A
FileInfocontaining file information to put into the gzip header.The file name and modification time from the file info will be used.
This will only be used if non-
NULLandformatisGZIP.Added in version 2.26.
- props.format: ZlibCompressorFormat#
The format of the compressed data.
Added in version 2.24.
- props.level: int#
The level of compression from
0(no compression) to9(most compression).-1for the default level.Added in version 2.24.
- props.os: int#
The OS code of the gzip header.
This will be used if set to a non-negative value, and if
formatisGZIP, the compressor will set the OS code of the gzip header to this value.If the value is unset, zlib will set the OS code depending on the platform. This may be undesirable when reproducible output is desired. In that case setting the OS code to
3(for Unix) is recommended.Added in version 2.86.