How to unpack an .asar file?
197,933
Solution 1
From the asar documentation
(the use of npx
here is to avoid to install the asar
tool globally with npm install -g asar
)
Extract the whole archive:
npx asar extract app.asar destfolder
Extract a particular file:
npx asar extract-file app.asar main.js
Solution 2
It is possible to upack without node installed using the following 7-Zip plugin:
http://www.tc4shell.com/en/7zip/asar/
Thanks @MayaPosch for mentioning that in this comment.
Related videos on Youtube

Author by
Vikas Bansal
javascript, typescript, ReactJs, Angularjs, Nodejs, Electronjs.... waiting for the next :) :P :D
Updated on May 01, 2021Comments
-
Vikas Bansal over 1 year
I have packed my Electron application using the following command:
asar pack app app.asar
Now, I need to unpack it and get the whole code back. Is there any way to do so?
-
Vikas Bansal over 6 yearsworked fine when run with sudo. Thanks for the answer, you are a life saver :)
-
neoDev almost 6 yearsThe electron docs say: "you can also package your app into an asar archive to avoid exposing your app's source code to users." but it is not true if you are then able to unpack it? right??
-
martpie almost 6 years@neoDev there's no real way to completely avoid exposing your code. But you can obfuscate it as much as you can with Asar, closure tools, etc...
-
Mike Chamberlain over 5 yearsSide note: you can install the command with
npm install -g asar
. -
Fake Name over 5 yearsOk, how do you unpack a asar file without having to install the entire node development environment?
-
Bernardo Dal Corno over 5 years@FakeName In theory, you only need node.exe and asar's source code, but npm will install all dependencies needed
-
martpie over 5 yearsIt is a tool for Node.js written in JS. You will need a JS engine with file access, in other words Node. github.com/electron/asar/tree/master/bin
-
MayaPosch almost 5 years@FakeName - I used the 7Zip plugin found in this thread at the 7Zip project: sourceforge.net/p/sevenzip/discussion/45797/thread/74cf1dec Allows one to open any ASAR file in 7Zip.
-
TmTron over 1 yearhere is the link to the 7zip asar plugin: tc4shell.com/en/7zip/asar
-
Alice 10 monthsHey this answer literally shows in google, any chance you can change the answer to say
npx asar extract app.asar app.asar.unpacked
as that's probably what users are going to be doing -
Wok 8 monthsThis does not seem to work for my use case. I have tried the plugin with both 7-Zip 21.07 (2021-12-26) and 7-Zip 19.00 (2019-02-21), as the plugin was last released in version 1.2 on 2020-03-05. Everything in 64-bit.
-
Wok 8 monthsAlso with 7-Zip 16.04 (2016-10-04). In every attempt, I get an "unspecified error".
-
Wok 8 monthsInvestigating at github.com/electron/asar/issues/110 as well.
-
Wok 8 monthsOne just needs to install Node (nodejs.org) in order to be able to run this command. It is light to install (28 MB).
-
Wok 8 monthsBy the way, as mentioned in the first comment, you will need admin rights, and access to Internet to download
asar
. -
Xavier Mukodi 8 months@neoDev yes, you're right. But it does give an extra level of security to your source code, since not everyone will go to the trouble of going through the unpacking process.