# npm-stats

> Convenience module for getting back data from an NPM registry

Latest version **1.2.0** (published 2016-02-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install npm-stats
pnpm add npm-stats
yarn add npm-stats
bun add npm-stats
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-02-02 |
| First published | 2013-03-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 50 |
| Author | Hugh Kennedy |
| Maintainers | bcoe, dsc, hughsk, zeke |
| Keywords | modules, npm, data, information, analytics, statistics, stats, users, keywords |

## Links

- npm: https://www.npmjs.com/package/npm-stats
- Repository: https://github.com/hughsk/npm-stats
- Homepage: https://github.com/hughsk/npm-stats#readme
- Issues: https://github.com/hughsk/npm-stats/issues
- npm.io page: https://npm.io/package/npm-stats

## Dependencies (7)

- [nano](https://npm.io/package/nano.md) ^6.2.0
- [request](https://npm.io/package/request.md) ~2.45.0
- [through](https://npm.io/package/through.md) ~2.3.6
- [JSONStream](https://npm.io/package/JSONStream.md) ~0.6.2
- [event-stream](https://npm.io/package/event-stream.md) ~3.0.12
- [lodash.merge](https://npm.io/package/lodash.merge.md) ~3.3.2
- [stream-reduce](https://npm.io/package/stream-reduce.md) ~1.0.3

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-02-02
- 1.1.1 — 2016-01-13
- 1.1.0 — 2014-11-12
- 1.0.1 — 2014-10-27
- 1.0.0 — 2014-09-22
- 0.3.0 — 2013-12-26
- 0.2.1 — 2013-12-18
- 0.2.0 — 2013-03-31
- 0.1.0 — 2013-03-30
- 0.0.1 — 2013-03-24

## README

# npm-stats #

Convenience module for getting back data from an NPM registry.
All of the methods return a JSON stream, and/or take a callback.
Where specified, some methods take an optional options object as well.

## API ##

**registry = require('npm-stats')([url, options])**

Returns a new registry instance,
defaulting to [isaacs.iriscouch.com](https://isaacs.iriscouch.com/).

Options:

* `dirty`: pass this as true to disable data cleaning, instead getting
  the raw data direct from NPM's CouchDB.
* `modules`: the database to use for retrieving modules. Defaults
  to "registry".
* `downloads`: the database to use for retrieving download data. Defaults
  to "downloads".
* `users`: the database to use for retrieving users. Defaults to "users".

**registry.list()**

Returns an array containing every module currently in the chosen NPM registry.

**registry.listByDate(options)**

Get a list of each module in the chosen NPM registry, sorted by date last
updated, in ascending order.

You can also pass the following options:

* `since`: only include modules updated since this date.
* `until`: only include modules updated before this date.

### Keywords ###

**registry.keyword(name).count()**

Get the number of modules using a specific keyword.

**registry.keyword(name).list()**

Get a list of modules using a specific keyword.

### Users ###

**registry.user(name).count()**

Get the number of modules a user has authored.

**registry.user(name).list()**

Get a list of the modules a user has authored.

**registry.user(name).starred()**

Get a list of the modules a user has starred.

### Modules ###

**registry.module(name).info()**

Returns the data normally accessible from
`https://registry.npmjs.org/:pkg`.

**registry.module(name).version(version)**

Returns the data normally accessible from
`http://registry.npmjs.org/:pkg/:version`.

**registry.module(name).downloads()**

Returns a list of download counts for the module, by date, e.g.:

``` json
[
  { "date": "2012-12-10", "value": 64 },
  { "date": "2012-12-11", "value": 82 }
]
```

Days without a download are omitted. Options:

* `since`: The earliest date to return download info from.
* `until`: The latest date to return download info from.

**registry.module(name).stars()**

Returns a list of the users who have starred a module.

**registry.module(name).dependents()**

Returns a list of modules that depend on a module.

**registry.module(name).latest()**

Returns the latest `package.json` file for a module.

**registry.module(name).field(name, [callback])**

Returns a field from the latest `package.json` file for a module.

**registry.module(name).size()**

Returns data on the module's size, e.g.

``` json
{
  "_id": "browserify",
  "size": 26338241,
  "count": 179,
  "avg": 147141.01117318432
}
```

---
_Source: https://npm.io/package/npm-stats · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
