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 archivesBadZipfileLargeZipFilePyZipFileZipInfois_zipfile()ZIP_STOREDZIP_DEFLATED- 12.4.1. ZipFile Objects
- 12.4.2. PyZipFile Objects
- 12.4.3. ZipInfo Objects
ZipInfo.filenameZipInfo.date_timeZipInfo.compress_typeZipInfo.commentZipInfo.extraZipInfo.create_systemZipInfo.create_versionZipInfo.extract_versionZipInfo.reservedZipInfo.flag_bitsZipInfo.volumeZipInfo.internal_attrZipInfo.external_attrZipInfo.header_offsetZipInfo.CRCZipInfo.compress_sizeZipInfo.file_size
- 12.4.4. Command-Line Interface
- 12.4.5. Decompression pitfalls
- 12.5.
tarfile— Read and write tar archive filesopen()TarFileis_tarfile()TarFileCompatTarErrorReadErrorCompressionErrorStreamErrorExtractErrorENCODINGHeaderErrorUSTAR_FORMATGNU_FORMATPAX_FORMATDEFAULT_FORMAT- 12.5.1. TarFile Objects
- 12.5.2. TarInfo Objects
TarInfoTarInfo.frombuf()TarInfo.fromtarfile()TarInfo.tobuf()TarInfo.nameTarInfo.sizeTarInfo.mtimeTarInfo.modeTarInfo.typeTarInfo.linknameTarInfo.uidTarInfo.gidTarInfo.unameTarInfo.gnameTarInfo.pax_headersTarInfo.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
