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.0rc1.tar.gz (38.9 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.0rc1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cabfile-2.0.0rc1.tar.gz
  • Upload date:
  • Size: 38.9 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.0rc1.tar.gz
Algorithm Hash digest
SHA256 cfb8f6b23b55477e62c3755bfcbddef0d230fcd6b5d5c51271d12538b29d9a67
MD5 8f808aa7469946fe638c1247b1085031
BLAKE2b-256 351a8afaf369ab9fa04f36ff47a93367cfe1e6fdd9fff40d71aa5b564e91e3a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cabfile-2.0.0rc1-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.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0e709e93f4f56e58174081b6c7be71bd410fb71dbe8b4a10e48a6e30d6f79cd
MD5 b742abed7519b38fce5ef58eb087c4a1
BLAKE2b-256 63595001d15c21c967faeee12f80d558acc28f875ee74cacaff458806852771f

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