kevva / download

Download and extract files
MIT License
1.28k stars 200 forks source link

Dropped download-status support which was available at version 3.0.0 #157

Closed ProphetDaniel closed 6 years ago

ProphetDaniel commented 6 years ago
  var Download = require('download');
  var downloadStatus = require('download-status');
  var download = new Download({extract: true, strip: 1})
    .get("https://github.com/ethereumproject/go-ethereum/releases/download/v5.2.0/geth-classic-linux-v5.2.0-480f90a.tar.gz")
    .dest('dest')
    .use(downloadStatus())
    .run();

and package.json

    "download-status": "^2.2.1",
    "download": "3.0.0",
motin commented 6 years ago

This is reported in download-status at https://github.com/kevva/download-status/issues/13

In that thread, there is even a workaround suggested: https://github.com/kevva/download/issues/106#issuecomment-243071351

ProphetDaniel commented 6 years ago

@motin Great, it worked perfectly for me: As I was also in need of decompression I changed a bit.

  const bar = new ProgressBar('[:bar] :percent :etas', {
    complete: '=',
    incomplete: ' ',
    width: 20,
    total: 0
  });

  download(selectedDownload.url, 'downloads', {extract: true, strip: 1})
    .on('response', res => {
      bar.total = res.headers['content-length'];
      res.on('data', data => bar.tick(data.length));
    })
    .then(() => {
    });