node-downloader-helper icon indicating copy to clipboard operation
node-downloader-helper copied to clipboard

Download completed, file incomplete

Open 277584579 opened this issue 1 year ago • 2 comments

const downloader = new DownloaderHelper( fileURL, filePath, options = { fileName: fileNameTmp, resumeIfFileExists: true, timeout:5000, removeOnStop:false, removeOnFail:false, retry:{ maxRetries:6, delay:5000 }, resumeOnIncomplete:true, resumeOnIncompleteMaxRetry:50 } ); downloader.start() downloader.on('end', (stats) => { console.log(stats) }) image I saw under the "end" callback that incomplete is false, but the size of onDiskSize and downloadedSize are different

277584579 avatar Jun 04 '24 12:06 277584579

Hello @277584579 , this is a correct behavior, this can be for many reasons, you could be using a pipe that is doing compression for example, you could be using a pipe to transform the data resulting in a different filesize , or you hard disk has compression enabled too, but if you look at totalSize and downloadedSize the values matches, the library doesnt rely on onDiskSize because of the previous mentioned

hgouveia avatar Jun 04 '24 15:06 hgouveia

But when I downloaded it and decompressed it, it showed that some files were damaged. How should I solve this problem? This is an occasional issue, not a mandatory occurrence image The same zip file, when I download it again and it displays as shown in the following picture, it is normal, The onDiskSize displayed twice is different image

277584579 avatar Jun 05 '24 01:06 277584579