JSPM

download-tarball

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8741
  • Score
    100M100P100Q129571F
  • License MIT

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

Package Exports

  • download-tarball

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (download-tarball) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

download-tarball

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

Installation

Download node at nodejs.org and install it, if you haven't already.

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

  • got: Simplified HTTP requests
  • gunzip-maybe: Transform stream that gunzips its input if it is gzipped and just echoes it if not
  • object-assign: ES2015 Object.assign() ponyfill
  • promisify-function: Turn a callback-style function into a function that returns a promise
  • pump: pipe streams together and close all of them if one of them closes
  • tar-fs: filesystem bindings for tar-stream

Dev Dependencies

  • babel-cli: Babel command line.
  • babel-core: Babel compiler core.
  • babel-preset-es2015: Babel preset for all es2015 plugins.
  • babel-tape-runner: Babel + Tape for running your ES Next tests
  • http-test-server: Create a simple http server for tests
  • package-json-to-readme: Generate a README.md from package.json contents
  • tapava: the syntax of ava, run through tape
  • tar-stream: tar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.
  • then-fs: promised FS
  • tmp: Temporary file and directory creator
  • xo: JavaScript happiness style linter ❤️

License

MIT

Generated by package-json-to-readme