[Updater > Request] Fix download progress
This commit is contained in:
parent
75d5cf0915
commit
80f9c6fc68
2 changed files with 4 additions and 4 deletions
|
@ -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…
Reference in a new issue