Format:ASAR archive (Electron)
| Developer | Electron / GitHub |
|---|---|
| Extensions | .asar |
| Endianness | little |
| License | MIT |
| Website | https://github.com/electron/asar |
| On this wiki | Facts · Code · Notes · Topics |
Electron's simple uncompressed archive (.asar): an 8-byte Chromium Pickle prefix, a JSON directory tree stored as a Pickle string, then the concatenated file contents; file entries give their offset (as a decimal string) and size relative to the end of the header.
Identification
- Electron apps keep their JavaScript in
resources/app.asar(Windows, Linux) orContents/Resources/app.asar(macOS), sometimes with a siblingapp.asar.unpacked/folder for native modules and files that must exist on disk. An app may also use a plainresources/app/folder (no archive) or a custom archive name. - The file starts with
04 00 00 00(the payload size of the first Pickle) followed by a uint32 header size, then another Pickle whose payload begins with a uint32 string length and the JSON text, usually{"files":{. So the bytes at offset 16 are usually{"files"(Fact:ASAR archive (Electron)/struct/ASAR file layout). - There is no compression and no encryption in the format; apps that hide code do it with extra layers (bytenode/V8 code cache, obfuscation, custom loaders). Unverified: how common each is.
Layout
| Offset | Contents |
|---|---|
| 0 | uint32 = 4 (size of the first Pickle's payload)
|
| 4 | uint32 header size N (size of the second Pickle, including its own 4-byte size field)
|
| 8 | second Pickle: uint32 payload size, uint32 JSON length L, the JSON bytes, zero padding to a multiple of 4
|
| 8 + N | file data; a file with offset O starts at 8 + N + O
|
A Chromium Pickle aligns every field to 4 bytes and is little-endian. The JSON tree has directories as {"files": {name: entry}}, files as {"size": n, "offset": "decimal string"} with optional executable: true and integrity, links as {"link": "relative path"}, and entries kept outside the archive as {"size": n, "unpacked": true} (stored in app.asar.unpacked/<same path>). Offsets are strings because JavaScript numbers lose precision above 2^53. Identical file contents are stored once and share an offset (Fact:ASAR archive (Electron)/struct/Header JSON entries).
Integrity block
A file entry may carry integrity: {"algorithm": "SHA256", "hash": hex of the whole file, "blockSize": 4194304, "blocks": [hex SHA-256 of each 4 MiB block]}. Electron can validate the header hash of a packaged app (the EnableEmbeddedAsarIntegrityValidation fuse, see Library:Electron#Fuses); the expected SHA-256 of the header JSON string (not of the whole file) is stored in the application's metadata: Info.plist ElectronAsarIntegrity on macOS, a resource of type Integrity named ElectronAsar (JSON list of file, alg, value) in the exe on Windows; details and evidence in Library:Electron#ASAR integrity.
Extraction
npx @electron/asar extract app.asar outdir (or asar list) unpacks it; a parser needs only the layout above. Beware: path names in a hostile archive can contain ..; extractors must reject entries whose name contains /, \, . or .. and check that offset+size is inside the file (the reference reader does).
Code & repositories
See the repository list below.
- https://github.com/electron/asar @
623d6addc0fe80c7fb2001ce611e1a645ab62bc4· license: MIT
Reference implementation of the ASAR archive (MIT): pack, list, extract, header validation, integrity blocks, Pickle reader.
Tested on: source read, not run: Read the TypeScript source at this commit; not run. · checked 2026-10-18; last activity 2026-10-10
Evidence & references
- electron/asar commit 623d6addc0fe80c7fb2001ce611e1a645ab62bc4 (MIT):
src/disk.tslines 324-355 (header read), 379-400 (file offset = 8 + headerSize + offset), 430-445 (writer), 28-135 (header validation),src/filesystem.ts(offset strings, de-duplication by hash),src/integrity.ts(SHA256, 4 MiB blocks),src/pickle.ts.