Skip to main content

asar

Library for working with Electron's ASAR archive files.

PyPI - Version PyPI - Python Version

Installation

pip install asar

Usage

  • pack and extract asar.
    from pathlib import Path
    from asar import create_archive, extract_archive
    
    create_archive(Path("src"), Path("app.asar"))
    extract_archive(Path("app.asar"), Path("dst"))
    
  • with unpack expression
    create_archive(Path("src"), Path("app.asar"), unpack="*.exe")
    
    then we got:
    .
    ├── app.asar
    └── app.asar.unpacked
        └── f2.exe
    
  • list files of asar
    from pathlib import Path
    from asar import AsarArchive
    
    with AsarArchive(Path("app.asar"), mode="r") as archive:
        print(archive.list())
    
    then we got:
    [Path('assets'), Path('assets/icon.png'), ...]
    
  • read one file from asar by random access
    from pathlib import Path
    from asar import AsarArchive
    
    with AsarArchive(Path("app.asar"), mode="r") as archive:
        print(archive.read(Path("f1.txt"), follow_link=True))
    
    then we got:
    b'Hello, Asar'
    
  • create an asar from another asar, without extracting to filesystem.
    import io 
    from pathlib import Path
    from asar import AsarArchive
    
    with AsarArchive(Path("app.asar"), mode="r") as reader, AsarArchive(Path("app.new.asar"), "w") as writer:
        writer.pack_other_asar(reader)
        writer.pack_file(path_in=Path("assets/added1.txt"), file_path=Path("added.txt"))
        writer.pack_stream(path_in=Path("assets/added2.txt"), file_reader=io.BytesIO(b"some text"))
    
    then we got app.new.asar, extract it:
    app_new_asar_extract
            ├── assets
            │     ├── added1.txt
            │     ├── added2.txt
            │     └── ... other files from app.asar 
            └── ... other files from app.asar
    

Metadata

Release files for asar 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asar 0.1.4
File Size Uploaded Provenance Actions
asar-0.1.4.tar.gz 10.5 kB Without provenance Details for asar-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for asar 0.1.4
File Interpreter ABI Platform Actions
asar-0.1.4-py3-none-any.whl Python 3 none any Details for asar-0.1.4-py3-none-any.whl

Total release size: 19.4 kB

Release files / asar-0.1.4.tar.gz

Download URL asar-0.1.4.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c3ff341ef6974556a43b11fd6a70fea3b3a700ae5d6a9b7ee1b6c4463ae43375
BLAKE2b-256 checksum
How to use checksums
28bc05757a8ab9f3de0b12273bbdd7125d9d3d4e7293588d45bd3ec57fa23c99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / asar-0.1.4-py3-none-any.whl

Download URL asar-0.1.4-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f30d9e51c309fc99adc8552ea7c05ea8233c5069c6661992b21b2c47f8e17cb4
BLAKE2b-256 checksum
How to use checksums
c96bbaa8b12920b4332caee7ecbab7127963c0e533c497ab2c8f7504da489e83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for asar 0.1.4

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page