Library for working with Electron's ASAR archive files
Project description
asar
Library for working with Electron's ASAR archive files.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asar-0.1.3.tar.gz
(9.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
asar-0.1.3-py3-none-any.whl
(8.7 kB
view details)
File details
Details for the file asar-0.1.3.tar.gz.
File metadata
- Download URL: asar-0.1.3.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1acf1ff02bf1422e768696fbaeb35672b5801ee066f78fdee4edfeaa65215ea1
|
|
| MD5 |
1d3d8aea909ee74eb2014f416f38aaaf
|
|
| BLAKE2b-256 |
669dce3ae33175999332a0ab70f819761c09223c344c8c73076e32758db9a754
|
File details
Details for the file asar-0.1.3-py3-none-any.whl.
File metadata
- Download URL: asar-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63aec0413baa681aa69a99cb0a10c518c98b6ad6bc51c47557c54134d2149ed8
|
|
| MD5 |
8ca952e74aa1cb55b01740c8a29a586a
|
|
| BLAKE2b-256 |
f385ba4449fce9b06eba0ee3e64ee08c9808b9e783fae846e50c380faa74e12d
|