asar-rust
Rust port of @electron/asar — create, extract, and inspect Electron ASAR archives with native performance. Provides both a library (asar_rust) and a CLI binary (asar).
Installation
CLI
Library
[]
= "0.1"
CLI Usage
# Pack a directory into an ASAR archive
# List all files in an archive
# List files with pack/unpack status
# Extract a single file
# Extract entire archive
# Pack with options
Library API
use *;
// Create an ASAR archive
create_package?;
// Create with options
let options = CreateOptions ;
create_package_with_options?;
// List all files
let files = list_package?;
for f in &files
// Extract a single file
extract_file?;
// Extract entire archive
extract_all?;
// Get raw header (JSON)
let header = get_raw_header?;
// Stat a file inside archive
let info = stat_file?;
println!;
// Open and inspect interactively
let archive = open?;
Features
- 📦 Pack/Unpack — Create ASAR archives from directories, extract fully or partially
- 📋 List/Stat — Inspect archive contents and file metadata
- 🔗 Symlink Support — Handle symbolic links within archives
- 🧩 Unpacked Files — Specify glob patterns for files/dirs to keep unpacked
- ✅ Integrity — SHA256-based header integrity verification
- 🔒 Path Validation — Prevent path traversal attacks
- 🚀 Performance — Optimized release profile (LTO, single codegen unit, size optimization)
Compatibility
Compatible with ASAR archives generated by the Node.js @electron/asar package. Archives created by either tool can be read by the other.
Minimum Supported Rust Version
Rust 1.85+ (2024 edition).
License
MIT — see LICENSE for details.