Metadata-Version: 2.4
Name: arpy
Version: 2.4.0
Summary: Library for accessing 'ar' files
Author-email: Stanisław Pitucha <viraptor@gmail.com>, ONEKEY <support@onekey.com>
License-Expression: BSD-2-Clause
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

Arpy
====

This library can be used to access **ar** files from python.

It supports both GNU and BSD formats and exposes the archived files using the standard python **file** interface.

Usage
=====

Standard file usage:
--------------------

With context managers:

```python
with arpy.Archive('file.ar') as ar:
    print("files: %s" % ar.namelist())
    with ar.open('content.txt') as f:
        print(f.read())
```

Via headers for duplicate names:

```python
with arpy.Archive('file.ar') as ar:
    for header in ar.infolist():
        print("file: %s" % header.name)
        with ar.open(header) as f:
            print(f.read())
```

Or directly:

```python
ar = arpy.Archive('file.ar'))
ar.read_all_headers()

# check all available files
ar.archived_files.keys()

# get the contents of the archived file
ar.archived_files[b'some_file'].read()
```

Stream / pipe / ... usage:
--------------------------

```python
ar = arpy.Archive('file.ar'))
for f in ar:
    print("got file name: %s" % f.header.name)
    print("with contents: %s" % f.read())
```


Contributions
=============

All contributions welcome. Just make sure that:

*  tests are provided
*  all current platforms are passing (tox configuration is provided)
*  coverage is close to 100% (currently only missing statements are those depending on python version being used)
