Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/anshsinghsonkhia/total-npm-downloads

An NPM Package to track the total package downloads of any NPM package from its launch date to today's date. <We Welcome Contributions for Hacktoberfest 2024>
https://github.com/anshsinghsonkhia/total-npm-downloads

hacktoberfest hacktoberfest-accepted hacktoberfest2024 javascript npm npm-package npmjs statistics

Last synced: 10 days ago
JSON representation

An NPM Package to track the total package downloads of any NPM package from its launch date to today's date. <We Welcome Contributions for Hacktoberfest 2024>

Awesome Lists containing this project

README

        

# total-npm-downloads
Track the total package downloads of any NPM package from its launch date to today's date.


# Installation

```shell
npm i total-npm-downloads
```

# Usage

### Replace the `package-name-to-check` to the NPM package name, you want know total downloads of.

```js
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:

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