|
|
@ -8464,15 +8464,16 @@ function downloadFile(url, fileStream) {
|
|
|
|
response.resume(); // Consume response data to free up memory
|
|
|
|
response.resume(); // Consume response data to free up memory
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
response.on('data', chunk => {
|
|
|
|
// response.on('data', chunk => {
|
|
|
|
fileStream.write(chunk);
|
|
|
|
// fileStream.write(chunk)
|
|
|
|
});
|
|
|
|
// })
|
|
|
|
response.on('end', () => {
|
|
|
|
response.on('end', () => {
|
|
|
|
resolve();
|
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
response.on('error', err => {
|
|
|
|
response.on('error', err => {
|
|
|
|
reject(err);
|
|
|
|
reject(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
response.pipe(fileStream);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
catch (err) {
|
|
|
|