asar

PNG files not found in ASAR

谁都会走 提交于 2019-12-24 01:33:05
问题 I have an Electron (1.7.10) application that is reporting it can't find 5 of 7 PNG files in my ASAR. All 7 PNGs are in the same folder, and 2 of them are displayed on screen fine. The other 5 report net::ERR_FILE_NOT_FOUND . All src attributes for the img tags are dynamically generated and use relative paths ( assets/images/MyImage.png ). If I extract the ASAR, I can see the files in there, in the correct folder (as referenced by the src attribute). If I use the console to set the location of

How should i exclude all node_modules in electron-packager

喜欢而已 提交于 2019-12-10 20:25:12
问题 I'm using electron-packager for creating an electron.exe of my app. I need to exclude all node modules . I tried the following --ignore=node_modules The above is not working. Any idea how to exclude all folders/ remove node modules in final build. 回答1: If you install modules as devDependencies , they will all be pruned automatically before packaging. If you're using electron-builder you can define glob patterns as files in the config. In this case !**/node_modules/* will exclude all of node

Executing a script inside an ASAR archive

Deadly 提交于 2019-12-08 07:41:30
I am attempting to run a script that is archived inside an ASAR file like so: var spawn = require('child_process').spawn; var t = spawn('node', ['./bundle.asar/main.js'], {}); t.on('data', function(data){ console.log(data.toString()); }); t.stdout.pipe(process.stdout); t.stderr.pipe(process.stderr); FYI the above script is situated outside the ASAR archive. However, all I get is the following error: Cannot find module 'C:\Users\MyUser\tests\asar-test\bundle.asar\main.js' The official docs on this particular issue are nonexistent. Is there some way to either read the ASAR file or require a

Executing a script inside an ASAR archive

怎甘沉沦 提交于 2019-12-08 03:31:15
问题 I am attempting to run a script that is archived inside an ASAR file like so: var spawn = require('child_process').spawn; var t = spawn('node', ['./bundle.asar/main.js'], {}); t.on('data', function(data){ console.log(data.toString()); }); t.stdout.pipe(process.stdout); t.stderr.pipe(process.stderr); FYI the above script is situated outside the ASAR archive. However, all I get is the following error: Cannot find module 'C:\Users\MyUser\tests\asar-test\bundle.asar\main.js' The official docs on

How to unpack an .asar file?

白昼怎懂夜的黑 提交于 2019-11-28 17:09:35
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? 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 It is possible to upack without node installed using the following 7Zip-plugin: http://www.tc4shell.com/en/7zip/asar/ Thanks @MayaPosch for mentioning that. 来源: https://stackoverflow