hgouveia / node-downloader-helper

A simple http file downloader for node.js
MIT License
247 stars 54 forks source link

downloaded file not completed #88

Closed Bluesgavin closed 1 year ago

Bluesgavin commented 2 years ago

Hi, I downloaded a image using the readme sample. But i got an incomplete image sometime. how can i solve this?

const downloader = (url, dir, option) => {
  return new Promise((resolve, reject) => {
    const dl = new DownloaderHelper(url, dir, option);
    dl.on('end', () => {
      resolve(true);
    });
    dl.on('error', (err) => {
      reject(err);
    });
    dl.start().catch((err) => {
      reject(err);
    });
  });
};
dowloader(url,dir,option);

image

Chaphasilor commented 2 years ago

Any errors being logged? Actual URLs would be nice to have for troubleshooting :)

Bluesgavin commented 2 years ago

Any errors being logged? Actual URLs would be nice to have for troubleshooting :)

There's no errors. The end event was normally emitted.

This is one of the URLs. https://dmai-aea.oss-cn-guangzhou.aliyuncs.com/aea/course/c1bdb590-6d26-493e-981c-305f9bf52fb3-.png

hgouveia commented 1 year ago

@Bluesgavin unfortunately there is nothing i can't do about this, this seems to be node.js level , is quite common but i just added new behavior in v2.1.2 that will resume the download if detect is incomplete, please check if solves it for you

Bluesgavin commented 1 year ago

@Bluesgavin unfortunately there is nothing i can't do about this, this seems to be node.js level , is quite common but i just added new behavior in v2.1.2 that will resume the download if detect is incomplete, please check if solves it for you

thank alot for your help 😀