Skip to main content

Interface: AsarOptions

Properties​

contentAlignment?​

optional contentAlignment?: number | null

Align the start of every packed file's content inside app.asar to a multiple of this many bytes (zero padding between files). Off when unset or 0.

Meant for differential updates with nsis.differentialPackage: "store-asar": the asar header stores every file's absolute content offset, so without alignment a change that grows a file by a single byte shifts the offset of every later file and most of the header has to be re-downloaded. With alignment a file can grow within its slot and no other offset moves. Measured on a 32 MB asar with 3,000 files: 512 cut a small length-changing edit from 414 KB to 139 KB of differential download for 2.2 % more asar size. Padding does not help when a file is added or removed (a new header entry shifts all later offsets) or when growth crosses the slot. File order, sizes and per-file integrity are unchanged; Electron and @electron/asar read files by offset + size and ignore the gaps.

Must be a positive integer; values above 64 KiB log a warning because every file is padded up to the boundary. The alignment is applied when electron-builder packs app.asar, so it is lost when the archive is rebuilt afterwards: macOS universal builds with mac.universal.mergeASARs (the default) repack the merged asar, and --prepackaged skips packing entirely.

Default​

0

disableIntegrity?​

optional disableIntegrity?: boolean

Whether to skip computing the ASAR integrity hash.

Normally electron-builder computes and embeds a SHA-256 hash of app.asar so that Electron can verify it at startup (when the enableEmbeddedAsarIntegrityValidation fuse is enabled). Set to true only for custom Electron forks with encrypted ASAR support where the header is not readable by standard tools. It also skips the macOS ASAR integrity digest (mac.asarIntegrityDigest).

Default​

false

disableSanityCheck?​

optional disableSanityCheck?: boolean

Whether to skip the ASAR package integrity sanity check.

Set to true only when using a custom Electron fork that implements its own encrypted or non-standard ASAR integrity validation that is not compatible with electron-builder's default check. Standard builds should leave this false.

Default​

false

ordering?​

optional ordering?: string | null

Path to a file containing the order in which files should be packed into the asar archive. Each line of the file is a relative path from the app directory. Files listed first are packed first, which can improve app startup time by front-loading frequently accessed modules. See the asar documentation for details.

Lines use the same syntax @electron/asar accepts: the path may carry a leading / or a <count>: prefix (as written by a load counter), and blank lines are ignored. There is no comment syntax, and `` separators are accepted. Directory entries are moved to the front in their original relative order (they hold no data), listed files follow in the order of the file, and every other file keeps its original order after them. Lines naming a directory are ignored, and listed files that are not in the archive are skipped.

The path is resolved like other build resources: relative to the build resources directory first, then to the project directory. A missing file fails the build. Packing files ahead of the default dependencies-first layout can increase differential update download size.


smartUnpack?​

optional smartUnpack?: boolean

Whether to automatically unpack executables files.

Default​

true

unpack?​

optional unpack?: string | string[] | null

A glob patterns relative to the app directory, which specifies which files to unpack when creating the asar archive.