total-npm-downloads
v1.0.2
Published
Track the total package downloads of any NPM package from its launch date to today's date.
Downloads
12
Maintainers
Readme
total-npm-downloads
Track the total package downloads of any NPM package from its launch date to today's date.
Installation
npm i total-npm-downloads
Usage
Replace the package-name-to-check
to the NPM package name, you want know total downloads of.
import getStats from 'total-npm-downloads';
async function getTotalDownloads(packageName) {
try {
const data = await getStats(packageName);
console.log(`Total downloads of "${packageName}" package:`, data.downloads);
} catch (error) {
console.log('Error:', error);
}
}
const packageName = 'package-name-to-check';
getTotalDownloads(packageName);
Example usage:
import getStats from 'total-npm-downloads';
async function getTotalDownloads(packageName) {
try {
const data = await getStats(packageName);
console.log(`Total downloads of "${packageName}" package:`, data.downloads);
} catch (error) {
console.log('Error:', error);
}
}
const packageName = 'uuid';
getTotalDownloads(packageName);
console.log(getTotalDownloads(packageName));