JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q56073F
  • License ISC

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 dlTgz = require('.');

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

dlTgz(url, 'my/dir').subscribe({
  next({entry: {bytes, header}}) {
    if (bytes !== header.size || !header.name) {
      return;
    }

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

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

Completed.

Installation

Use npm.

npm install dl-tgz

API

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

dlTgz(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

ISC License © 2017 Shinnosuke Watanabe