Skip to content

formats

ZhouSicheng-2011 edited this page Jul 31, 2026 · 1 revision

Formats classes and constants


BitInFormat

Read‑only format used for extracting or inspecting archives. Typically used by BitFileExtractor.

Public Methods

Method Description
__eq__(self, other: BitInFormat) -> bool Checks if two format objects are equal.
__ne__(self, other: BitInFormat) -> bool Checks if two format objects are not equal.
value(self) -> int Returns the internal ID value of this format in the 7z SDK.

BitInOutFormat

Read‑write format, supporting both extraction and creation of archives. Typically used by BitFileCompressor (inherits from BitInFormat).

Public Methods

Method Description
__eq__(self, other: BitInOutFormat) -> bool Checks if two format objects are equal.
__ne__(self, other: BitInOutFormat) -> bool Checks if two format objects are not equal.
value(self) -> int Returns the internal ID value of this format in the 7z SDK.
default_method(self) -> bit7z_python.BitCompressionMethod Returns the default compression method used by this format.
features(self) -> bit7z_python.FormatFeatures Returns the feature bitset supported by this format.
has_feature(self, feature: bit7z_python.FormatFeatures) -> bool Checks whether this format supports the given feature.

Available Format Constants

These constants are exported in top module bit7z_python and can be used directly (like bit7z_python.FORMAT_7Z).
Some formats only supports extraction(BitInFormat objects), and some of them supports compression and extraction(BitInOutFormat).

Constant English Description 中文描述
FORMAT_APM Apple Partition Map (disk image) Apple 分区映射(磁盘映像)
FORMAT_ARJ ARJ archive (older compression) ARJ 归档(较旧的压缩格式)
FORMAT_AUTO Auto‑detect format (for reading only) 自动检测格式(仅用于读取)
FORMAT_BZIP2 BZip2 compression BZip2 压缩格式
FORMAT_CAB Microsoft Cabinet archive Microsoft Cabinet 归档
FORMAT_CHM Compiled HTML Help 编译的 HTML 帮助文件
FORMAT_COFF Common Object File Format 通用对象文件格式
FORMAT_COMPOUND Microsoft Compound File Microsoft 复合文件
FORMAT_CPIO CPIO archive (used in Unix initramfs) CPIO 归档(用于 Unix initramfs)
FORMAT_CRAMFS Compressed ROM file system 压缩的 ROM 文件系统
FORMAT_DEB Debian software package Debian 软件包
FORMAT_DMG Apple Disk Image Apple 磁盘映像
FORMAT_ELF Executable and Linkable Format 可执行与可链接格式
FORMAT_EXT Extended file system (ext2/ext3/ext4) 扩展文件系统(ext2/ext3/ext4)
FORMAT_FAT File Allocation Table (FAT) 文件分配表(FAT)
FORMAT_FLV Flash Video format Flash 视频格式
FORMAT_GPT GUID Partition Table GUID 分区表
FORMAT_GZIP GZip compression GZip 压缩格式
FORMAT_HFS Hierarchical File System (HFS) 分层文件系统(HFS)
FORMAT_HXS Microsoft Help 2.x Microsoft Help 2.x
FORMAT_IHEX Intel HEX file format Intel HEX 文件格式
FORMAT_ISO ISO 9660 CD/DVD image ISO 9660 CD/DVD 映像
FORMAT_LZH LZH compression (older) LZH 压缩(较旧)
FORMAT_LZMA LZMA compression (standalone) LZMA 压缩(独立)
FORMAT_LZMA86 LZMA with x86 filter 带 x86 过滤器的 LZMA
FORMAT_MACHO Mach‑O object format Mach‑O 对象格式
FORMAT_MBR Master Boot Record 主引导记录
FORMAT_MSLZ Microsoft LZ compression Microsoft LZ 压缩
FORMAT_MUB MUB format (unknown) MUB 格式(未知)
FORMAT_NSIS Nullsoft Scriptable Install System Nullsoft 脚本安装系统
FORMAT_NTFS New Technology File System NTFS 文件系统
FORMAT_PE Portable Executable (Windows) 可移植可执行文件(Windows)
FORMAT_PPMD PPMd compression PPMd 压缩
FORMAT_QCOW QEMU Copy‑On‑Write disk image QEMU 写时复制磁盘映像
FORMAT_RAR RAR archive (older version) RAR 归档(旧版)
FORMAT_RAR5 RAR5 archive RAR5 归档
FORMAT_RPM Red Hat Package Manager Red Hat 软件包管理器
FORMAT_SPLIT Split archive 分割归档
FORMAT_SQUASHFS SquashFS compressed file system SquashFS 压缩文件系统
FORMAT_SWF Small Web Format (Flash) 小型网络格式(Flash)
FORMAT_SWFC Compressed SWF 压缩的 SWF
FORMAT_TAR Tarball archive Tarball 归档
FORMAT_TE TE format (uncommon) TE 格式(不常见)
FORMAT_UDF Universal Disk Format 通用磁盘格式
FORMAT_UEFIC UEFI firmware capsule UEFI 固件胶囊
FORMAT_UEFIS UEFI firmware image UEFI 固件映像
FORMAT_VDI VirtualBox Disk Image VirtualBox 磁盘映像
FORMAT_VHD Virtual Hard Disk 虚拟硬盘
FORMAT_VHDX Virtual Hard Disk v2 虚拟硬盘 v2
FORMAT_VMDK Virtual Machine Disk 虚拟机磁盘
FORMAT_WIM Windows Imaging Format Windows 映像格式
FORMAT_XAR eXtensible ARchive 可扩展归档
FORMAT_XZ XZ compression XZ 压缩格式
FORMAT_Z Unix compress (.Z) format Unix compress (.Z) 格式
FORMAT_ZIP Zip archive Zip 归档

Notice: FORMAT_AUTO is only for reading / extraction – it cannot be used when creating or updating archives. Most commonly used archive formats (like 7Z, ZIP, GZIP, XZ, TAR, WIM) are BitInOutFormat objects, supporting both read and write operations.

Clone this wiki locally