turbo-downloader
Advanced tools
Comparing version
@@ -151,3 +151,3 @@ "use strict"; | ||
const stream = response.data; | ||
const fd = yield fs_extra_1.default.open(this.options.destFile, 'a'); | ||
const fd = yield fs_extra_1.default.open(this.options.destFile, 'r+'); | ||
try { | ||
@@ -173,3 +173,3 @@ yield new Promise((resolve, reject) => { | ||
finally { | ||
fs_extra_1.default.close(fd); | ||
yield fs_extra_1.default.close(fd); | ||
} | ||
@@ -255,3 +255,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fd = yield fs_extra_1.default.open(this.options.destFile, 'a'); | ||
const fd = yield fs_extra_1.default.open(this.options.destFile, 'w'); | ||
if (options.size > 0) { | ||
@@ -258,0 +258,0 @@ const buffer = Buffer.alloc(DEFAULT_CHUNK_SIZE).fill(0); |
@@ -51,6 +51,7 @@ "use strict"; | ||
url: fileForTesting, | ||
destFile: tempFile, | ||
destFile: tempFile | ||
}); | ||
try { | ||
yield downloader.download(); | ||
expect(fs.lstatSync(tempFile).size).toEqual(fileSize); | ||
expect(checkMd5(tempFile, fileMd5)).toBeTruthy(); | ||
@@ -85,2 +86,3 @@ } | ||
yield downloader.download(); | ||
expect(fs.lstatSync(tempFile).size).toEqual(fileSize); | ||
expect(checkMd5(tempFile, fileMd5)).toBeTruthy(); | ||
@@ -87,0 +89,0 @@ } |
{ | ||
"name": "turbo-downloader", | ||
"author": "Denis Bezrukov <anthrax63@gmail.com>", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -45,3 +45,5 @@ "main": "dist/index.js", | ||
"partial download", | ||
"resumable download" | ||
"resumable download", | ||
"electron", | ||
"typescript" | ||
], | ||
@@ -48,0 +50,0 @@ "license": "ISC", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
34455
1.04%486
0.41%