node.js 如何解压 .asar 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38523617/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 20:25:33  来源:igfitidea点击:

How to unpack an .asar file?

node.jselectronasar

提问by Vikas Bansal

I have packed my electron application using follwoing command

我已经使用以下命令打包了我的电子应用程序

asar pack app app.asar

Now, I need to unpack it and get the whole code back. Is there anyway to do so?

现在,我需要解压缩它并取回整个代码。无论如何要这样做吗?

回答by martpie

From the asar documentation

来自asar文档

(the use of npxhere is to avoid to install the asartool globally with npm install -g asar)

npx这里的使用是为了避免用asar全局安装工具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

回答by Sebastian Ax

It is possible to upack without node installed using the following 7Zip-plugin:
http://www.tc4shell.com/en/7zip/asar/

可以使用以下 7Zip 插件在没有安装节点的情况下进行打包:http://www.tc4shell.com/en/7zip/asar/

Thanks @MayaPosch for mentioning that.

感谢@MayaPosch 提到这一点。