npm-pkg-info

Universal npm info model.
Install
npm install --save npm-pkg-info
Use Case
const NpmPackage = require('npm-pkg-info')
NpmPackage.fromRemote('react').then(info => {
console.log(info.name)
})
PackageInfo
The structure of a package info:
{
name: '',
description: '',
distTags: '',
versions: {
},
readme: '',
homepage: '',
maintainers: [
],
time: {
},
author: {
},
repository: {
},
license: '',
keywords: [],
latest: {}
}
API
Api generated by jsdoc2md.
NpmPackage
Class for npm package info
Kind: global class
npmPackage.getInfoByDistTag(distTag)
get info by dist-tag
Kind: instance method of NpmPackage
Param | Type | Description |
---|
distTag | string | dist-tag |
npmPackage.getInfoByVersion(ver)
get info by specific version
Kind: instance method of NpmPackage
Param | Type | Description |
---|
ver | string | version |
npmPackage.getLatestInfoByMajorVer(majorVer)
get latest info by the major version
Kind: instance method of NpmPackage
Param | Type | Description |
---|
majorVer | number | major number of a version |
npmPackage.getLatestVersionsByMajor()
get latest versions of all major verions
Kind: instance method of NpmPackage
NpmPackage.fromRemote(packageName, registry)
create package instance by remote request from registry
Kind: static method of NpmPackage
Param | Type | Description |
---|
packageName | string | name of the npm package |
registry | string | registry url |