is there any way to set up a progress bar for downloading new update of app in Electron? I am developing app for Windows using Squirrel and electron-simple-updater
and my problem is that updater only gives out events when it starts to download update and when it finishes. My update is kinda large (around 80MB) and for users with slow ISPs it kinda sux :(
Asked
Active
Viewed 1.1k times
9

Pirozek
- 1,250
- 4
- 16
- 25
-
1Looking for the same, google is not helping ... – GWorking May 04 '17 at 06:22
-
Same here...the 'download-progress' is not fired using electron-simple-updater. Did you manage to find a workaround? – MarBVI Sep 13 '17 at 15:35
-
@MarBVI nope, I am stuck here. Its really bad that if you need this simple thing you have to do all the work yourself meaning building your own updater. Thats where maybe I will end up, because there seems to be no viable solutions for this problem :( – Pirozek Sep 14 '17 at 06:32
-
Actually I'm not even able to download the update. I'm getting an error "Cannot find Squirrel". I'm also using electrin-simple-updater and creating my .exe with electron-builder. Any help you can give me? – MarBVI Sep 14 '17 at 11:58
2 Answers
6
const log = require('electron-log');
const { autoUpdater } = require("electron-updater");
autoUpdater.logger = log;
log.info('App starting...');
autoUpdater.on('download-progress', (progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
sendStatusToWindow(log_message);
})
function sendStatusToWindow(text) {
log.info(text);
homePageWindow.webContents.send('message', text);
}
With this code the log can be seen to see the progress of the download

Vaibhav Vishal
- 6,576
- 7
- 27
- 48

Darshan Jain
- 781
- 9
- 19
-
2NOTE: The package `require("electron-updater")` is strictly for Electron Builder, not for native Electron. If you are not using Electron Builder, you cannot import and use this package as shown here. – Joshua Pinter Mar 18 '19 at 19:26
-
1Is there any way I can get rid of all the decimals on `progressObj.percent`? – Lucas Apr 22 '20 at 12:05
-
3
4
Maybe this link gives what you want
https://github.com/iffy/electron-updater-example/blob/master/main.js
autoUpdater.on('download-progress', (ev, progressObj) => {
sendStatusToWindow('Download progress...');
})

GWorking
- 4,011
- 10
- 49
- 90
-
1
-
1Note, this doesn't appear to work with Electron's native autoUpdater: https://electronjs.org/docs/api/auto-updater – Joshua Pinter Jan 16 '19 at 21:35
-
@joshuapinter Correct, this is not for electron's auto-updater. It's most likely for Electron Builder's custom auto updater. – Joshua Pinter Mar 18 '19 at 19:25