[Updater > Request] Fix download progress

main
Oj 2 years ago
parent 75d5cf0915
commit 80f9c6fc68

@ -559,10 +559,10 @@ async function processDownloadQueue() {
const stream = _fs.default.createWriteStream(moduleZipPath);
stream.on('progress', ({
receivedBytes: newReceivedBytes,
stream.on('progress', ([
newReceivedBytes,
totalBytes
}) => {
]) => {
receivedBytes = newReceivedBytes;
const newProgress = Math.min(Math.floor(100 * (receivedBytes / totalBytes)), 100);

@ -17,7 +17,7 @@ const nodeRequest = ({ method, url, headers, qs, timeout, body, stream }) => new
if (!stream) return;
outOf += chunk.length;
stream.write(chunk);
stream.emit('progress', { total, outOf });
stream.emit('progress', [ outOf, total ]);
});
response.on('end', () => {

Loading…
Cancel
Save