Andrew Howard
Andrew Howard

Reputation: 3092

Execute electron packager from node express route

I’m not able to find much info on this however I know that I can create an electron app via the command prompt electron-packager .. However is it possible to execute it front end via a node express route?

So I'd like to do something like this:

router.get('/downloadGame/', async function(req, res) {
    var dirPath = "../game/src";

// Run electron packager here against this folder
// And then zip it up

await res.zip({
    files: [{
        path: dirPath,
        name: 'Package'
    }],
    filename: 'Package.zip'
});

});

Upvotes: 1

Views: 192

Answers (1)

255kb - Mockoon
255kb - Mockoon

Reputation: 6974

I don't think Electron Packager can be used programmatically. I didn't find any relevant information in the documentation. However, I think you could use Node.js' child_process.exec() function to run the command like you are used to (considering that Electron Packager is installed on the server).

You could also use another library Electron Builder that offers such functionality.

Upvotes: 1

Related Questions