1.0.9 • Published 6 months ago

fast-asar v1.0.9

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

fast-asar

A faster implementation of Electron's ASAR archive format.

This is both a library and a CLI tool.

Installation

You can install fast-asar from NPM (or your preferred package manager):

npm install fast-asar

Usage

CLI

You can use the CLI tool to extract and create ASAR archives.

npx fast-asar help

Library

The library exports an Asar class, which can be used to read and write ASAR archives.

For example, to extract an ASAR archive to a directory:

import { Asar } from "fast-asar";
import { readFile } from "fs/promises";

const asarBytes = await readFile("./app.asar");

const asar = new Asar(asarBytes);

await asar.extract("./app-extracted");

For more information, see the API documentation.

Compatibility

This library can be run with Node.js and Bun.

Browser support is planned.

Benchmarks

The following benchmarks were run with hyperfine on a 2016 MacBook Pro with a 2.9 GHz Quad-Core Intel Core i7 processor and 16 GB of RAM.

Extract files

This benchmark extracts all files in the Replit Desktop app's app.asar file.

CommandMean msMin msMax msRelative
./node_modules/.bin/asar extract test/ignore/app.asar test/ignore/app1670.0 ± 52.6614.6739.41.54 ± 0.41
bun ./src/cli/index.ts extract test/ignore/app.asar test/ignore/app2435.1 ± 110.9373.7632.31.00

Summary: fast-asar is 1.54 ± 0.41 times faster than @electron/asar.

To run this benchmark yourself, run bun run benchmark:extract.

Pack directories

This benchmark packs the src directory into an ASAR archive at test/ignore/src.asar.

CommandMean msMin msMax msRelative
./node_modules/.bin/asar pack src test/ignore/src.asar154.7 ± 45.3123.4231.71.93 ± 0.57
bun ./src/cli/index.ts pack src test/ignore/src.asar80.0 ± 3.177.685.41.00

Summary: fast-asar is 1.93 ± 0.57 times faster than @electron/asar.

To run this benchmark yourself, run bun run benchmark:pack.

List files

This benchmark lists all files in the Replit Desktop app's app.asar file.

CommandMean msMin msMax msRelative
./node_modules/.bin/asar list test/ignore/app.asar136.0 ± 31.3117.5191.51.28 ± 0.30
bun ./src/cli/index.ts list test/ignore/app.asar106.0 ± 5.9101.3116.21.00

Summary: fast-asar is 1.28 ± 0.30 times faster than @electron/asar.

To run this benchmark yourself, run bun run benchmark:list.

Contributing

Running tests

For the tests, you must have the Replit Desktop app's app.asar file in the test/ignore directory. You can get this file by installing the Replit Desktop app and copying the app.asar file from the installation directory.

Then, to run all tests:

bun pretest
bun test
1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago