You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When extracting a zip file that contains another electron app (or any .asar file), the file should extract normally with no errors.
Actual behavior
When extracting a zip file that contains another electron app (or any .asar file), Electron throws a Invalid package error and does not extract the .asar files at all (all other files are extracted correctly. Only the .asar files do not extract), rendering the extracted app useless.
How to reproduce
Download a zip file containing an electron app and try to extract it using Node/Electron.
Alright now that the format is filled out I'll explain what's going on a bit more. I am attempting to write my own "update checker" script for my electron app, which does not require Squirrel, however when extracting the downloaded zip file (which is a zip file containing the updated electron app data), Electron throws an error saying there is an Invalid package and refuses to extract the .asar files (all other files are extracted correctly. Only the .asar files do not extract).
I would prefer to not use Squirrel as, from my understanding, Squirrel requires the user to install the application. I would prefer to keep my application as portable as possible, so that users can simply download the latest build, extract it and run.
I am using these two functions to download and extract the update files:
downloadFile('http://example.com/update.zip',path.join(__dirname,'./'),'update.zip',function(){// http://example.com/update.zip is not the real sourceapp.relaunch();app.quit();});
This script works perfectly fine for other zip files, it only throws the error when downloading the app updates. I have tried nearly every unzipping package I could find, but all throw errors when trying to extract the updates.
Also it should be noted that the files in the zip file are indeed functional. Extracting the zip file using WinRAR yields no errors and the app runs as normal. The error is only thrown, and the app fails to extract, when being extracted by another Electron app.
Due to the fact that it only happens when working with Electron, and the error is only thrown when unzipping an Electron app, I'm inclined to believe it's something to do with Electron itself and not the Node modules. Hence this issue report.
The text was updated successfully, but these errors were encountered:
@RedDuckss This is due to the electron fs module treating asar files as directories rather than files. To make the unzip process work you need to do one of two things
Expected behavior
When extracting a zip file that contains another electron app (or any
.asar
file), the file should extract normally with no errors.Actual behavior
When extracting a zip file that contains another electron app (or any
.asar
file), Electron throws aInvalid package
error and does not extract the.asar
files at all (all other files are extracted correctly. Only the.asar
files do not extract), rendering the extracted app useless.How to reproduce
Download a zip file containing an electron app and try to extract it using Node/Electron.
Alright now that the format is filled out I'll explain what's going on a bit more. I am attempting to write my own "update checker" script for my electron app, which does not require Squirrel, however when extracting the downloaded zip file (which is a zip file containing the updated electron app data), Electron throws an error saying there is an
Invalid package
and refuses to extract the.asar
files (all other files are extracted correctly. Only the.asar
files do not extract).I would prefer to not use Squirrel as, from my understanding, Squirrel requires the user to install the application. I would prefer to keep my application as portable as possible, so that users can simply download the latest build, extract it and run.
I am using these two functions to download and extract the update files:
And I am calling the update via:
Using the
unzipper
Node package (https://www.npmjs.com/package/unzipper) to handle extracting.I have tried https://www.npmjs.com/package/electron-basic-updater, which does not throw the JavaScript error, but it still does not extract the
.asar
files at all, which means the "update" is still useless.This script works perfectly fine for other zip files, it only throws the error when downloading the app updates. I have tried nearly every unzipping package I could find, but all throw errors when trying to extract the updates.
Also it should be noted that the files in the zip file are indeed functional. Extracting the zip file using WinRAR yields no errors and the app runs as normal. The error is only thrown, and the app fails to extract, when being extracted by another Electron app.
Due to the fact that it only happens when working with Electron, and the error is only thrown when unzipping an Electron app, I'm inclined to believe it's something to do with Electron itself and not the Node modules. Hence this issue report.
The text was updated successfully, but these errors were encountered: