Skip to main content

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 extraction
  • is_cabinet(source) -> bool for safe type checks
  • probe(source) -> CabSummary for 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:

  • 0 success
  • 1 test command found unreadable archive data
  • 2 usage 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)

Source distribution for cabfile 2.0.0
File Size Uploaded
cabfile-2.0.0.tar.gz 39.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cabfile 2.0.0
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.0

1 release file

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page