[Updater > Request] Fix download progress

This commit is contained in:
Ducko 2022-02-11 08:52:00 +00:00
parent 75d5cf0915
commit 80f9c6fc68
2 changed files with 4 additions and 4 deletions

View file

@ -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);

View file

@ -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', () => {