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
Extract an archive
sarc extract ARCHIVE
Create an archive
sarc create [--be] FILES_TO_ADD DEST_SARC
You can give it directories too, in which case the entire directory will be added to the archive recursively.
Pass --be (shorthand: -b) if you want sarc to use big endian mode (for the Wii U).
An important option is --base-path. This option lets you remove parts of the path.
For example, if you pass a path like Mods/BotW/System/Version.txt, you will likely want to pass
--base-path Mods/BotW to get rid of the leading components.
If only a single directory is passed, the base path is set for you automatically.
So typical usage example:
sarc create ~/botw/Bootup/ ~/botw/ModifiedBootup.pack
Update an archive
sarc update FILES_TO_ADD SARC_TO_MODIFY
This is almost identical to create.
By default, sarc will keep the endianness of the original archive. You can override this
with --endian {le,be} (le for little and be for big endian).
Delete files from an archive
sarc delete FILES_TO_DELETE SARC_TO_MODIFY
Nothing much to say here. Just keep in mind FILES_TO_DELETE takes archive paths
(those that are printed by list).
Library usage
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:
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.
License
This software is licensed under the terms of the GNU General Public License, version 2 or later.
Metadata
Release files for sarc 2.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sarc-2.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Release files / sarc-2.0.5-py3-none-any.whl
| Download URL | sarc-2.0.5-py3-none-any.whl |
|---|---|
| Size | 19.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d95cbb60aeb1e921eac25671864b507b39289ef795161cbdb331f98b029e555
|
|
BLAKE2b-256 checksum How to use checksums |
48e17b2c78dfbe76e7af3c234143d7847f1adde00b0e4f437b85f092e7cea535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for sarc 2.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.