ar
Python package for parsing ar archive file.
Installation
pip install ar
Usage
List files inside file.a
from ar import Archive
with open('file.a', 'rb') as f:
archive = Archive(f)
for entry in archive:
print(entry.name)
Read content of file.txt
contained within file.a
.
from ar import Archive
with open('file.a', 'rb') as f:
archive = Archive(f)
print(archive.open('file.txt').read())
Extract all files:
from ar import Archive
with open('file.a', 'rb') as f:
archive = Archive(f)
for entry in archive:
with open(entry.name, 'wb') as output:
content = archive.open(entry, 'rb').read()
output.write(content)
Developing
Create a virtual environment using python version of liking
python3.10 -m venv venv
Activate it
source venv/bin/activate
Install package editable together with relevant optional dependencies
pip install -e '.[test,dev]'
Author
Samuel Carlsson