On GitHub, electron/asar has picked up 2.9k stars, Frontend, TypeScript. Simple extensive tar-like archive format with indexing
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
ASAR is a simple extensive archive format. It concatenates all files together without compression
(like tar) while having random access support.
Features
Support random access
Use JSON to store file information
Very easy to write a parser
Store the contents of duplicated files only once
CLI
Install
This module requires Node 22.12.0 or later.
npm install --engine-strict @electron/asar
Usage
$ asar --help
Usage: asar [options] [command]
Commands:
pack|p <dir> <output>
create asar archive
list|l <archive>
list files of asar archive
extract-file|ef <archive> <filename>
extract one file from archive
extract|e <archive> <dest>
extract archive
Options:
-h, --help output usage information
-V, --version output the version number
asar pack app app.asar --unpack-dir "{**/x1,**/x2,z4/w1}"
Programmatic usage
For full API usage, see the API documentation.
Example
import { createPackage } from '@electron/asar';
const src = 'some/path/';
const dest = 'name.asar';
await createPackage(src, dest);
console.log('done.');
Please note that there is currently no error handling provided!
Deduplication
Files with identical contents are stored once and shared: the first copy is
written into the archive and every other copy's header entry points at that same
offset. Nothing changes for readers — each file still has its own entry, size,
integrity hash, and executable bit — but archives with duplicated contents (a
common shape for bundled node_modules) get smaller and pack faster, since the
redundant bytes are never written.
Unpacked files (unpack / unpackDir) are always written out in full, because
they live on disk outside the archive.
Transform
You can pass in a transform option, that is a function, which either returns
nothing, or a stream.Transform. The latter will be used on files that will be
in the .asar file to transform them (e.g. compress).
import { createPackageWithOptions } from '@electron/asar';
const src = 'some/path/';
const dest = 'name.asar';
function transform (filename) {
return new CustomTransformStream()
}
await createPackageWithOptions(src, dest, { transform: transform });
console.log('done.');
Format
Asar uses Pickle to safely serialize binary value to file.
offset and size records the information to read the file from archive, the
offset starts from 0 so you have to manually add the size of header_size and
header to the offset to get the real offset of the file.
Files with identical contents share a single copy in the archive, so more than
one entry can point at the same offset.
offset is a UINT64 number represented in string, because there is no way to
precisely represent UINT64 in JavaScript Number. size is a JavaScript
Number that is no larger than Number.MAX_SAFE_INTEGER, which has a value of
9007199254740991 and is about 8PB in size. We didn't store size in UINT64
because file size in Node.js is represented as Number and it is not safe to
convert Number to UINT64.
integrity is an object consisting of a few keys:
A hashing algorithm, currently only SHA256 is supported.
A hex encoded hash value representing the hash of the entire file.
An array of hex encoded hashes for the blocks of the file (i.e. for a blockSize of 4KB, this array contains the hash of every block if you split the file into N 4KB blocks).
A integer value blockSize representing the size in bytes of each block in the blocks hashes above.
The most recent commit recorded on electron/asar was 9 days ago, based on the GitHub push timestamp. The repository has 269 forks — one of the better signals of community interest.
How does electron/asar compare to other Frontend projects?
electron/asar is tracked by TopGit in the Frontend category, with 2.9k GitHub stars and written in TypeScript. Browse the Frontend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does electron/asar have?
electron/asar has 2.9k GitHub stars — refresh the page for the live number, or check github.com/electron/asar. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is electron/asar open source?
Yes — electron/asar ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/electron/asar.
What is electron/asar?
electron/asar (electron/asar) is a TypeScript project on GitHub. From the project's own README: Simple extensive tar-like archive format with indexing
Where do I read more about electron/asar?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/electron/asar is the definitive source.
Read full README in the tab above.
Want a second opinion on asar?
Ask an AI that can read this page — one click and you get its take on asar.