0
votes

I have created a Node-Webkit application and I am trying to implement application auto-update.

What I have done till now is:

  1. I am checking version of my application's package.json with the package.json from server.
  2. If they are different, I will download the new .exe from server.
  3. It's downloaded to user-folder\AppData\Local\Temp\ folder

Now I want to close the application which is open and run the new exe file. But I want to do it pragmatically. Can anyone help me in doing this? Is there a way to open application when it's path is specified?

Any kind of help is appreciated. Thanks in advance

1

1 Answers

2
votes

You can use spawn from the child_process API.

Spawn the new exe, detach it and unreference it, then close the current app.

Something like:

require("child_process").spawn('path/to/new/exe', [], {detached: true}).unref();
require('nw.gui').Window.get().close(true);