npm package stats
$ npm install --save npmstat
const npmstat = require('npmstat')
npmstat.getPackage('npmstat').then(res => res)
// => { name: 'npmstat', description: 'npm package stats', ... }
npmstat.getPackages('bukinoshita').then(res => res)
// => [{ name: 'react-cookies', version: '0.1.0', ... }, { name: 'is-github-repo', version: '0.2.0', ... }, ...]
npmstat.getDownloads('react-cookies').then(res => res)
// => { downloads: 19271, package: 'react-cookies', ... }
Returns a promise
Get npm package information
Type: string
Required
Package name
npmstat.getPackage('npmstat')
.then(pkg => pkg)
.catch(err => err)
// => { name: 'npmstat', description: 'npm packages stats', ... }
Returns a promise
Get user npm pkgs information
Type: string
Required
npm username
npmstat.getPackages('bukinoshita')
.then(pkg => pkg)
.catch(err => err)
// => [{ name: 'react-cookies', version: '0.1.0', ... }, { name: 'is-github-repo', version: '0.2.0', ... }, ...]
Returns a promise
Get npm package downloads count
Type: string
Required
Package name
npmstat.getDownloads('react-cookies')
.then(pkg => pkg)
.catch(err => err)
// => { downloads: 19271, package: 'react-cookies', ... }
Type: object
Type: string
Default: last-month
Options: last-day
, last-week
, last-month
, YYYY-MM-DD
(specific date) or YYYY-MM-DD:YYYY-MM-DD
(specific month)
- last-day: Gets downloads for the last available day. In practice, this will usually be "yesterday" (in GMT) but if stats for that day have not yet landed, it will be the day before.
- last-week: Gets downloads for the last 7 available days.
- last-month: Gets downloads for the last 30 available days.
npmstat.getDownloads('react-cookies', { range: 'last-week' })
.then(pkg => pkg)
.catch(err => err)
// => { downloads: 19271, package: 'react-cookies', ... }
Type: string
Default: point
Options: point
or range
npmstat.getDownloads('react-cookies', { type: 'range' })
.then(pkg => pkg)
.catch(err => err)
// => { package: 'react-cookies', downloads: [{ downloads: 100, day: '2017-06-8'}, ...], ... }
- npmstat-cli — CLI for this module
MIT © Bu Kinoshita