npm-download-count

Retrieve package's number of downloads in a period of time


Keywords
npm, npm-registry
Install
npm install npm-download-count@1.0.2

Documentation

This fork makes use of promises and accepts range inputs, e.g. last-month

npm-download-counts

Fetch package download counts for packages from the npm registry

Build Status

Note: the npm download counts are pretty dodgy for a number of reasons, you probably shouldn't pretend they are accurate.

const moment = require('moment')
    , downloadCounts = require('npm-download-counts-v2')

    , package_name    = 'levelup'
    , start  = moment().subtract(3, 'days').toDate() // start date for lookup
    , end    = new Date()                              // end date for lookup

downloadCounts({
    package_name,
    time_period: {
        start,
        end,
    },
})
.then(count => {
    console.log('%s was downloaded ~%d times in the last 3 days', package_name, count)
});

downloadCounts({
    package_name,
    time_period: 'last-month',
})
.then(count => {
    console.log('%s was downloaded ~%d times in the last month', package_name, count)
});

Gives you something like:

levelup was downloaded ~122450 times in the last month
levelup was downloaded ~16344 times in the last 3 days