Skip to content

Commit

Permalink
Add setup and library usage info to README
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Aug 30, 2018
1 parent 22e7695 commit 8b4b6b6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
41 changes: 41 additions & 0 deletions README.md
@@ -1,5 +1,9 @@
## Nintendo SARC archive reader and writer

### Setup

Install Python 3.6+ (**64 bit version**) then run `pip install sarc`.

### List files in an archive

sarc list ARCHIVE
Expand Down Expand Up @@ -43,6 +47,43 @@ with `--endian {le,be}` (le for little and be for big endian).
Nothing much to say here. Just keep in mind FILES_TO_DELETE takes archive paths
(those that are printed by `list`).

### Library usage

```python
import sarc

archive = sarc.read_file_and_make_sarc(file)
# or if you already have a buffer
archive = sarc.SARC(archive_bytes)
if archive:
for file_name in archive.list_files():
size = archive.get_file_size(file_name)
data = archive.get_file_data(file_name)

```

To modify an archive:

```python
import sarc

writer = sarc.make_writer_from_sarc(archive)
# or if you're reading from a file
writer = sarc.read_sarc_and_make_writer(file)
# or for a blank archive
writer = sarc.SARCWriter(be=big_endian)

writer.add_file('test.bfevfl', b'file contents')
writer.add_file('another_file.txt', b'file contents')
writer.add_file('test.bfevfl', b'replacing a file')

writer.delete_file('another_file.txt')

writer.write(output_stream)
```

For more information, please look at [sarc.py](sarc/sarc.py).

### License

This software is licensed under the terms of the GNU General Public License, version 2 or later.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="sarc",
version="1.0.5",
version="1.0.5-1",
author="leoetlino",
author_email="leo@leolam.fr",
description="Nintendo SARC archive reader and writer",
Expand Down

0 comments on commit 8b4b6b6

Please sign in to comment.