How to package a Unix executable into an AppImage format using Electron-packager?

I am using Electron-packager to package my Electron React app on Windows/MacOS/Linux Ubuntu. Only AppImage is supported for Electron-updater auto-updates, and therefore I am looking to package for Linux to .appimage format.

However, my app calls a Unix executable compiled separately, which I package within the Electron app by specifying extraFiles in the package.json file. I have no problem calling this executable using child processes on Windows/MacOS (formats for which I can see the full app folder structure after packaging and installing), but I am not able to call the Unix executable when packaging for an AppImage, for which I can’t see how the folder structure is defined within.

My question: When I package an Electron app with AppImage, how can I package a Unix executable within and what is the path to call it via child processes in JavaScript?

That’s exactly the way to do it.
However, you must ensure that the executable bit is set on the executable file and that it does not have any dependencies that are not part of every target system in a recent enough version. (Or else you have to bundle them as well.)

Right, how do I call the executable within the AppImage after it is packaged?

I use child.spawn() to spawn the process on Windows/MacOS, and for those I can easily know the path to my executable because I can inspect the content of the packaged application once installed, but I wasn’t able to do that with AppImage. Is there a way to see the file structure of the AppImage file?

If not, can you clarify how the structure is so that I can figure out how to properly access the path of the executable published within? For context, I am packaging this extra executable within this AppImage, and I want it to be run when the user clicks a button.

Thank you very much for your reply!

Philippe

Just run the AppImage with --appimage-extract to see what file went where.

Unfortunately I have never worked with Electron at all, so I don’t know the specifics. Maybe best ask in an Electron-related forum.