New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fast-asar

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-asar

A faster implementation of Electron's ASAR archive format.

  • 1.0.9
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-30.77%
Maintainers
1
Weekly downloads
 
Created
Source

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 [ms]Min [ms]Max [ms]Relative
./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 [ms]Min [ms]Max [ms]Relative
./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 [ms]Min [ms]Max [ms]Relative
./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

FAQs

Package last updated on 30 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc