Skip to main content

Windows cabinet (.cab) file reader

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cabfile-2.0.0.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cabfile-2.0.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file cabfile-2.0.0.tar.gz.

File metadata

  • Download URL: cabfile-2.0.0.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for cabfile-2.0.0.tar.gz
Algorithm Hash digest
SHA256 5782a1ba626329c0f655bb9c1ffdc1abe0f483c75e137e25afd76c5f54de12d2
MD5 0a7141788605abe9b16f75534cc72e17
BLAKE2b-256 0c001d011deeee611224f55b1e89b95c5a899018561338378b26ab74c44aba20

See more details on using hashes here.

File details

Details for the file cabfile-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cabfile-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for cabfile-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15c59d67eca67ab1f436f60bdbe040dffb26bc290047717b7f2304afd733a4da
MD5 019f34ce9230c78125148b6bb821a2f7
BLAKE2b-256 560660e7476eeb2be8321c54e9ec32e6467c6e994e2e72434857f3db3e0640cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page