Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.31 KB

README.md

File metadata and controls

52 lines (38 loc) · 1.31 KB

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));