cabfile
Read Windows .cab archives with a small, practical API.
The modern API is centered on CabFile and two helpers:
CabFile(source)for member listing, reading, and extractionis_cabinet(source) -> boolfor safe type checksprobe(source) -> CabSummaryfor fast cabinet-level metadata
Quick start
import cabfile
with cabfile.CabFile("archive.cab") as cab:
print(cab.namelist())
payload = cab.read("hello.txt")
print(cabfile.is_cabinet("archive.cab"))
summary = cabfile.probe("archive.cab")
print(summary.file_count)
API shape
CabFile exposes two complementary layers:
- Member-centric methods for metadata + payload workflows:
read_members(names=None)extract_members(target_dir, names=None)
- ZipFile-compatible methods/properties for drop-in usage patterns:
read,extract,extractall,namelist,infolist,getinfo,printdir,filelist,NameToInfo
CLI
The package includes a ZipFile-style CLI via the cabfile script or python -m cabfile.
# List archive members
cabfile -l archive.cab
# Test archive readability
cabfile -t archive.cab
# Extract all members to target directory
cabfile -e archive.cab output_dir
Note: Exit codes are process-style:
0success1test command found unreadable archive data2usage or cabinet read error
Compatibility
Note: This project uses ctypes with Windows cabinet.dll APIs.
It is intended for Windows environments.
Note: CAB decryption/password handling is not supported.
ZipFile-shaped pwd parameters are accepted for compatibility but raise NotImplementedError when provided.
Background
Based on the Microsoft Cabinet SDK API surface (FDI), with compatibility ideas borrowed from zipfile.py.
Metadata
Release files for cabfile 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cabfile-2.0.0.tar.gz | 39.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cabfile-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.8 kB
Release files / cabfile-2.0.0.tar.gz
| Download URL | cabfile-2.0.0.tar.gz |
|---|---|
| Size | 39.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5782a1ba626329c0f655bb9c1ffdc1abe0f483c75e137e25afd76c5f54de12d2
|
|
BLAKE2b-256 checksum How to use checksums |
0c001d011deeee611224f55b1e89b95c5a899018561338378b26ab74c44aba20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / cabfile-2.0.0-py3-none-any.whl
| Download URL | cabfile-2.0.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
15c59d67eca67ab1f436f60bdbe040dffb26bc290047717b7f2304afd733a4da
|
|
BLAKE2b-256 checksum How to use checksums |
560660e7476eeb2be8321c54e9ec32e6467c6e994e2e72434857f3db3e0640cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|