@ndelangen/get-tarball
Download a tarball (optionally gzipped) to a folder & extract it in the process. Uses the wonderful & super quick tar-fs & gunzip-maybe srcraries.
Last updated 3 years ago by ndelangen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ndelangen/get-tarball 
SYNC missed versions from official npm registry.

download-tarball

Download a tarball (optionally gzipped) to a folder & extract it in the process. Uses the wonderful & super quick tar-fs & gunzip-maybe srcraries.

Installation

This is a Node.js module available through the npm registry. It can be installed using the npm or yarn command line tools.

npm install download-tarball --save

Usage

/* eslint-disable import/no-extraneous-dependencies */

import download from 'download-tarball';

download({
  url: 'http://link-to-tarball/file.tar.gz',
  dir: '/dir/where/file/will/be/downloaded'
}).then(() => {
  console.log('file is now downloaded!');
}).catch(err => {
  console.log('oh crap the file could not be downloaded properly');
  console.log(err);
});

download({
  url: 'http://link-to-tarball/file.tar.gz',
  dir: '/dir/where/file/will/be/downloaded',
  // custom options that will be forwarded to got.stream(..., opts) can also be set
  gotOpts: {
    headers: {
      beep: 'boop'
    }
  }
}).then(() => {
  console.log('file is now downloaded!');
}).catch(err => {
  console.log('oh crap the file could not be downloaded properly');
  console.log(err);
});

download({
  // neat, tar files works as well!
  url: 'http://link-to-tarball/file.tar',
  dir: '/dir/where/file/will/be/downloaded'
}).then(() => {
  console.log('file is now downloaded!');
}).catch(err => {
  console.log('oh crap the file could not be downloaded properly');
  console.log(err);
});

Tests

npm install
npm test

Dependencies

  • gunzip-maybe: Transform stream that gunzips its input if it is gzipped and just echoes it if not
  • pump: pipe streams together and close all of them if one of them closes
  • tar-fs: filesystem bindings for tar-stream

License

MIT

Current Tags

  • 3.0.7--canary.49a7f05.0                                ...           canary (3 years ago)
  • 3.0.9                                ...           latest (3 years ago)

8 Versions

  • 3.0.9                                ...           3 years ago
  • 3.0.8                                ...           3 years ago
  • 3.0.7                                ...           3 years ago
  • 3.0.7--canary.49a7f05.0                                ...           3 years ago
  • 3.0.6                                ...           3 years ago
  • 3.0.5                                ...           3 years ago
  • 3.0.4                                ...           3 years ago
  • 3.0.3                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (3)
Dev Dependencies (15)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |