Python interface to libarchive
Project description
A Python interface to libarchive. It uses the standard ctypes module to dynamically load and access the C library.
Installation
pip install libarchive-c
python-libarchive-c is compatible with python 2 and 3.
Usage
Import:
import libarchive
To extract an archive to the current directory:
libarchive.extract_file('test.zip')
extract_memory extracts from a buffer instead, and extract_fd extracts from a file descriptor.
To read an archive:
with libarchive.file_reader('test.7z') as archive: for entry in archive: for block in entry.get_blocks(): ...
memory_reader reads from a memory buffer instead, and fd_reader reads from a file descriptor.
To create an archive:
with libarchive.file_writer('test.tar.gz', 'ustar', 'gzip') as archive: archive.add_files('libarchive/', 'README.rst')
memory_writer writes to a memory buffer instead, fd_writer writes to a file descriptor, and custom_writer sends the data to a callback function.
You can also find more thorough examples in the tests/ directory.
License
LGPLv2 (or any later version)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file libarchive-c-2.0.tar.gz
.
File metadata
- Download URL: libarchive-c-2.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 763ad5d13be62c149108dba5b81000efdb4be8967a9564fe6cb1e3ade6d8647b |
|
MD5 | f17392c5b6a1051f403cb65501198928 |
|
BLAKE2b-256 | 3514f84ebd4d89ed8862ccf3e406b632df836cbc3b6f5148dc98ffb9fdd31d28 |
File details
Details for the file libarchive_c-2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: libarchive_c-2.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b7daaedd1229c1a3e43119c41e72d362acb710c40503c7cdc98951edbea62a1 |
|
MD5 | 33b1b5eb5b13d77ea85ed50d1bc67438 |
|
BLAKE2b-256 | cbccd20479228c2a0647b840e1edd18f7cf42c4f06a687de22827b4a711831d6 |