asar-pack

command module
v0.0.0-...-6182d9b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 12 Imported by: 0

README

asar-pack

Efficient .asar packer tool.

This was created as a quick replacement due to very high memory usage, low performance and limit of 2^21 entries (files+directories) in globbed directories (due to use of Promise.all) in official asar tool.

For a sample dataset of ~2.6 milion 2-4 byte files in 2 directories deep tree on a consumer NVMe drive asar-pack is able to create a bundle in about a minute. In contrast, at that point, official asar tool would need increase in NodeJS stack size, patching for Promise.all argument length, and would still fail after ~1.5h on header JSON.stringify string size limit.

Limitations

Due to its simplicity this tool has several limitations:

  • Missing glob patterns support
  • Missing integrity (seems to work with latest Electron just fine due to backwards compatiblity)
  • Empty directories are not emitted in the bundle
  • Missing executable flag
  • Missing ordering file support
  • Missing --unpack functionality
  • Missing --exclude-hidden functionality
  • Missing listing/extraction functionality

Building

CGO_ENABLED=0 go build .

Usage

./asar-pack -source /source/path -output /artifact/target.asar
Testing dataset
for a in {0..40}; do
    echo $a;
    for b in {0..255}; do
        mkdir -p $a/$b;
        for c in {0..255}; do
            echo $c > $a/$b/$c;
        done;
    done;
done

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL