Skip to content

fetches the package information for an npm package

License

Notifications You must be signed in to change notification settings

nombrekeff/npm-package

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm-package

fetches the package information for an npm package

Usage

npm install --save npm-package-info

or

npm install -g npm-package-info

node module

var npmPackage = require('npm-package-info')

// get a public package
npmPackage('package-name', function(err, pkg) {
  // pkg is an object containing the contents of package.json
})

// get a private github package
npmPackage('user/repo', { token: 'githubtoken' }, function(err, pkg) {
  // same as above
})

command line

# public
$ npm-package package-name
# private
$ npm-package --token githubtoken package-name
# both above commands output pretty printed json to stdout

# disable pretty-printing (print json all on one line)
$ npm-package --raw package-name

generating a github token

The tokens used above are for accessing private github content via the API. You can find out how to generate a github token here:

https://help.github.com/articles/creating-an-access-token-for-command-line-use/

FAQ

  • Does this work with private npm hosts?

I dunno, but probably. I don't currently use private npm packages or self hosted npm, so testing and reporting issues in this area would be appreciated!

  • Does this work with ?

Probably! This uses the same resolver as npm core, so in theory it should be able to resolve anything npm can resolve, including version numbers and tags. That being said, if you find something that doesn't work, please file an issue so I can fix it.

About

fetches the package information for an npm package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%