JSPM

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

Download and extract a gzipped tar archive with the Observable API

Package Exports

  • dl-tgz

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 (dl-tgz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

dl-tgz

NPM version Build Status Coverage Status

A Node.js module to download and extract a gzipped tar (tar.gz) archive with the Observable API

const {readdirSync} = require('fs');
const dlTar = require('dl-tgz');

const url = 'https://github.com/github/hub/releases/download/v2.2.9/hub-darwin-amd64-2.2.9.tgz';

dlTar(url, 'my/dir').subscribe({
  next({header, bytes}) {
    if (bytes !== header.size) {
      return;
    }

    console.log(`${header.name}`);
  },
  complete() {
    readdirSync('my/dir'); //=> [ 'LICENSE', 'README.md', 'bin', 'etc', ...]

    console.log('\nCompleted.')
  }
});
✓ bin/hub
✓ README.md
✓ LICENSE
✓ etc/README.md
✓ etc/hub.bash_completion.sh
✓ etc/hub.zsh_completion
✓ share/man/man1/hub.1
✓ install

Completed.

Installation

Use npm.

npm install dl-tgz

API

const dlTar = require('dl-tgz');

dlTar(tgzArchiveUrl, extractDir [, options])

tgzArchiveUrl: String
extractDir: String (a path where the archive will be extracted)
options: Object
Return: Observable (zenparsing's implementation)

It works just like dl-tar, except that tarTransform option defaults to a zlib.Gunzip stream and unchangeable.

License

Copyright (c) 2017 Shinnosuke Watanabe

Licensed under the MIT License.