12. Data Compression and Archiving¶
The modules described in this chapter support data compression with the zlib,
gzip, and bzip2 algorithms, and the creation of ZIP- and tar-format archives.
See also Archiving operations provided by the shutil
module.
- 12.1.
zlib
— Compression compatible with gzip - 12.2.
gzip
— Support for gzip files - 12.3.
bz2
— Compression compatible with bzip2 - 12.4.
zipfile
— Work with ZIP archivesBadZipfile
LargeZipFile
PyZipFile
ZipInfo
is_zipfile()
ZIP_STORED
ZIP_DEFLATED
- 12.4.1. ZipFile Objects
- 12.4.2. PyZipFile Objects
- 12.4.3. ZipInfo Objects
ZipInfo.filename
ZipInfo.date_time
ZipInfo.compress_type
ZipInfo.comment
ZipInfo.extra
ZipInfo.create_system
ZipInfo.create_version
ZipInfo.extract_version
ZipInfo.reserved
ZipInfo.flag_bits
ZipInfo.volume
ZipInfo.internal_attr
ZipInfo.external_attr
ZipInfo.header_offset
ZipInfo.CRC
ZipInfo.compress_size
ZipInfo.file_size
- 12.4.4. Command-Line Interface
- 12.5.
tarfile
— Read and write tar archive filesopen()
TarFile
is_tarfile()
TarFileCompat
TarError
ReadError
CompressionError
StreamError
ExtractError
ENCODING
HeaderError
USTAR_FORMAT
GNU_FORMAT
PAX_FORMAT
DEFAULT_FORMAT
- 12.5.1. TarFile Objects
- 12.5.2. TarInfo Objects
TarInfo
TarInfo.frombuf()
TarInfo.fromtarfile()
TarInfo.tobuf()
TarInfo.name
TarInfo.size
TarInfo.mtime
TarInfo.mode
TarInfo.type
TarInfo.linkname
TarInfo.uid
TarInfo.gid
TarInfo.uname
TarInfo.gname
TarInfo.pax_headers
TarInfo.isfile()
TarInfo.isreg()
TarInfo.isdir()
TarInfo.issym()
TarInfo.islnk()
TarInfo.ischr()
TarInfo.isblk()
TarInfo.isfifo()
TarInfo.isdev()
- 12.5.3. Examples
- 12.5.4. Supported tar formats
- 12.5.5. Unicode issues