-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WASM fails to read archives in packaged Electron app #322
Comments
An update on this: I was forced to compile an Electron-exclusive version of the WASM to include NODEFS (NodeJS File System). This now works fine when the app is run by Electron from the File System: the app can mount the WASM and can read the packaged archive. HOWEVER; when the app is packaged by Electron Builder, the main app is placed inside an asar archive, and the packaged archive is (intentionally) left outside that archive. Despite multiple attempts to "cross the barrier" by mounting the File System from different directories, so far I have not been able to instruct the WASM to read anything outside of the asar archive. It appears that the "root" of the FS is the top-level directory INSIDE the asar archive. This means I either have to include the ZIM archive inside the asar, which is problematic for large archives, or else I have to ship without asar packing, which is particularly problematic for the portable app (because it takes too long to decompress all the app's files on startup vs decompressing a single asar). |
Removing asar packaging doesn't solve the issue. See openzim/javascript-libzim#26 (comment) for more details. It's very odd: the libzim WASM reads the packaged archive perfectly well when running Some guesses:
I guess the second of these is the most likely, but I tried several things to try to understand the directory structure and where root was, and haven't managed to solve it yet. |
It was indeed the way the file system paths were being passed to the WASM. I've pushed a fix to #323. |
As a follow-on from openzim/javascript-libzim#26, the WASM fails to read archives when running inside a packaged Electron app. It gives the error
stream.node.contents.slice is not a function
.However, if running the app inside Electron in a non-packaged version (e.g.
npm start
) everything works fine with picked archives. This suggests that the issue is not with the framework, but with the way that packaged apps are read when the provider is node.js as opposed to a File object. It may be necessary to convert the node File to a File object. Alternatively, the issue could be caused by the compressedasar
file system used by the Electron app (although the archive itself is not inside asar).The text was updated successfully, but these errors were encountered: