How to unpack an .asar file?

ASAR (Atom Shell Archive) is a simple extensive archive format used by Electron applications to bundle various files, including JavaScript, HTML, CSS, and other assets, into a single archive. This archive format is similar to a ZIP file but optimised for Electron apps.

To unpack an ASAR file, you can use the asar tool provided by Electron. If you don’t have it installed, you can install it via npm:

npm install -g asar

Then you can use the asar tool to extract the whole archive or a particular file from the archive:

# Extract the whole archive
asar extract app.asar <destfolder>
# Extract a particular file
asar extract-file app.asar main.js

Alternatively, you can use npx to run the asar tool without installing it globally:

# Extract the whole archive
npx asar extract app.asar <destfolder>
# Extract a particular file
npx asar extract-file app.asar main.js

Another way to unpack ASAR files is by using 7-Zip with a plugin called Azar7z. After installing the plugin, you can use 7-Zip to open, unpack, and package ASAR files.

For more advanced usage, such as transforming the files during the extraction process or excluding multiple resources from being packed, you can refer to the official Electron ASAR documentation and the asar npm package documentation.

Споделяне

Was this article helpful?
YesNo

Вашият коментар