Microsoft Compound File Binary File Format IO
Project description
cfb
Read-only access to Microsoft Compound File Binary (CFB/OLE2) files from Python.
Installation
pip install cfb
Development
make install # create .venv and install with dev dependencies
Usage
from cfb import CfbIO
from cfb.directory.entry import SEEK_END
doc = CfbIO("tests/data/simple.doc")
# Read the root entry buffer.
root = doc.root
print(root.read())
# Access entries by name and seek within them.
entry = doc["1Table"]
entry.seek(100, SEEK_END)
print(entry.read(100))
# Access entries by directory ID.
sibling = doc[1].left
sibling.seek(0)
print(sibling.read(64))
All objects are lazy-loaded, so opening a large file only reads data when you explicitly access it.
Development
make install # create .venv and install all dev dependencies
make format # run black
make lint # run ruff
make typecheck # run mypy
make test # run pytest with coverage
make tox # run tests across Python 3.8, 3.10, and 3.12
make clean # remove build artefacts and the virtualenv
License
BSD 2-Clause — see LICENSE.txt.
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
cfb-0.9.3.tar.gz
(16.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cfb-0.9.3-py3-none-any.whl
(13.0 kB
view details)
File details
Details for the file cfb-0.9.3.tar.gz.
File metadata
- Download URL: cfb-0.9.3.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92bd2427d13ba6936665ce6e44598b63f929d87874ed37a971ece4d6a89e7070
|
|
| MD5 |
24530cfb2f2fb337a15d187079119107
|
|
| BLAKE2b-256 |
6d0351deea75f3b1611b48ef91ec769f190ccf3bdb1c469a83352cb615cd2771
|
File details
Details for the file cfb-0.9.3-py3-none-any.whl.
File metadata
- Download URL: cfb-0.9.3-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3560a1446f90598e58051c5816bec0b359b327a6001ac94d19604e6986698ce2
|
|
| MD5 |
c9e306f9ea41f78bedc403306129f415
|
|
| BLAKE2b-256 |
6ffe98076cc6ed976a66949676a00a6fbed8321d8b862f4889871b2bdf39be65
|