turbo-downloader
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -171,2 +171,3 @@ "use strict"; | ||
: responseStream; | ||
let writePromise; | ||
const fd = yield fs_extra_1.default.open(this.options.destFile, 'r+'); | ||
@@ -176,3 +177,3 @@ try { | ||
abortHandler(() => { | ||
stream.pause(); | ||
responseStream.pause(); | ||
cancelTokenSource.cancel(); | ||
@@ -186,3 +187,4 @@ resolve(); | ||
this.emit('chunkDownloadProgress', chunk); | ||
yield fs_extra_1.default.write(fd, buffer, 0, buffer.length, chunk.disposition + dl); | ||
writePromise = fs_extra_1.default.write(fd, buffer, 0, buffer.length, chunk.disposition + dl); | ||
yield writePromise; | ||
stream.resume(); | ||
@@ -200,2 +202,8 @@ progressCallback(chunk); | ||
finally { | ||
if (writePromise) { | ||
yield writePromise; | ||
} | ||
if (!responseStream.destroyed) { | ||
responseStream.destroy(); | ||
} | ||
yield fs_extra_1.default.close(fd); | ||
@@ -202,0 +210,0 @@ } |
{ | ||
"name": "turbo-downloader", | ||
"author": "Denis Bezrukov <anthrax63@gmail.com>", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46973
626