Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maddhruv/npmtotal
Find you npm download statistics
https://github.com/maddhruv/npmtotal
cli download-statistics npm npm-stats npmstats
Last synced: about 1 month ago
JSON representation
Find you npm download statistics
- Host: GitHub
- URL: https://github.com/maddhruv/npmtotal
- Owner: maddhruv
- Created: 2020-01-22T02:14:37.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T15:42:45.000Z (about 2 years ago)
- Last Synced: 2024-08-09T09:39:18.614Z (4 months ago)
- Topics: cli, download-statistics, npm, npm-stats, npmstats
- Language: JavaScript
- Size: 466 KB
- Stars: 16
- Watchers: 4
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# npmtotal
Find your npm download statistics by author or packages, can be used as a [CLI](#cli) or [Module](#module)
## Installation
`npm i npmtotal -g`
or
`npm i npmtotal`
when consuming as a [module](#module)## Usage
### CLI
For npm `author`
> `npx npmtotal --author authorName`
and for npm `packages`
> `npx npmtotal --packages package1 package2 ...`
### Module
```js
const npmtotal = require("npmtotal");// author
(async () => {
console.log(await npmtotal("maddhruv"));
})();// packages
(async () => {
console.log(await npmtotal(["npmtotal", "post-merge-install"]));
})();
```The returned object is of this structure.
```js
{
stats: [
[String(packageName), Number(downloads)]
],
sum: Number(totalDownloads)
}
```#### Options
You can pass several options as the second param.
| Option | Description | Default value |
| ----------- | --------------------------------- | ---------------- |
| `exclude` | an array of packages to exclude | [] |
| `startDate` | start date for counting downloads | _today - 1 year_ |
| `endDate` | end date for counting downloads | _today_ |You can also pass `startDate` and `endDate` as options to the CLI
`npx npmtotal --author maddhruv --startDate '2020-01-01' --endDate '2020-01-03'`
### Related
- [npm-statistics](https://github.com/cleartax/npm-statistics) - NPM Download Stats updated daily with badge and readme update