npm-get
v0.2.1
Published
Fetch files and list directories from npm packages
Downloads
6
Maintainers
Readme
npm-get
Fetches files and lists directories from npm packages.
Does not pollute your file system like some other npm downloaders do.
Example
$ npm-get npm-get
LICENSE
README.md
cli.js
index.js
package.json
$ npm-get npm-get index.js
'use strict';
var npm = require('npm'),
got = require('got'),
untar = require('tar').Parse,
# ...
CLI
npm-get [-l | --long] [--pager] <package> [<path>]
Lists directory or fetches file contents at <path>
.
With --long
, prints full paths for nested directories.
With --pager
, shows result in a $PAGER
. This is not equivalent to npm-get ... | $PAGER
. Instead, the pager gets the file name argument which allows for syntax highlighting (e.g. via $LESSOPEN
hook).
API
npmGet(package, [path], [opts], cb(err, entries, contents))
Downloads file or directory listing from package
.
path
— path to file in the package. Defaults to /
(root).
entries
— single entry or array of entries representing a single file or list of files. Each entry is guaranteed to have at least path
and type
properties, with the latter having such values as Directory
, File
among others (as defined by node-tar).
contents
— array of file names or string of file's contents.
opts.fullPaths
Type: Boolean
Default: false
Enables full paths output for nested directories.
Related
- github-get — fetch files and list directories from GitHub repositories.
Install
npm install -g npm-get
License
MIT