This commit is contained in:
eric sciple 2019-12-10 01:40:30 -05:00
parent 64fcc0c59a
commit a039094e93
2 changed files with 8 additions and 6 deletions

7
dist/index.js vendored
View File

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

View File

@ -142,15 +142,16 @@ function downloadFile(url: string, fileStream: WriteStream): Promise<void> {
return
}
response.on('data', chunk => {
fileStream.write(chunk)
})
// response.on('data', chunk => {
// fileStream.write(chunk)
// })
response.on('end', () => {
resolve()
})
response.on('error', err => {
reject(err)
})
response.pipe(fileStream)
})
} catch (err) {
reject(err)