# npm-registry-analytics

> An opinionated client for the npm package download counts API written in TypeScript

Latest version **1.0.0** (published 2023-09-30) · MIT-0 license · 0 weekly downloads

## Install

```sh
npm install npm-registry-analytics
pnpm add npm-registry-analytics
yarn add npm-registry-analytics
bun add npm-registry-analytics
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-09-30 |
| First published | 2023-09-30 |
| Weekly downloads | 0 |
| License | MIT-0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 116.7 KB |
| Known vulnerabilities | 0 (+12 in 1 direct dependencies) |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2 |
| Author | Andrea Amorosi |
| Maintainers | dreamorosi |
| Keywords | npm, ts, downloads, download, registry, api, client, count |

## Links

- npm: https://www.npmjs.com/package/npm-registry-analytics
- Repository: https://github.com/dreamorosi/npm-registry-analytics
- Homepage: https://github.com/dreamorosi/npm-registry-analytics#readme
- Issues: https://github.com/dreamorosi/npm-registry-analytics/issues
- npm.io page: https://npm.io/package/npm-registry-analytics

## Dependencies (3)

- [zod](https://npm.io/package/zod.md) ^3.22.2
- [undici](https://npm.io/package/undici.md) ^5.25.2
- [date-fns](https://npm.io/package/date-fns.md) ^2.30.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-09-30

## README

# npm-registry-analytics

An opinionated client for the npm package download counts API written in TypeScript.

## Install

```bash
npm i npm-registry-analytics@latest
```

## Usage

```typescript
import { NpmRegistryClient } from 'npm-registry-analytics';

// Create a new client
const client = new NpmRegistryClient();

// get download count for a package on a specific day
await client.getDay({
  packages: ['@aws-lambda-powertools/logger'],
  date: '2020-01-01', // Also accepts Date objects
});

// get download count for multiple packages during a week
await client.getWeek({
  packages: ['@aws-lambda-powertools/logger', '@aws-lambda-powertools/core'],
  // Uses the date to determine the week
  // Also accepts Date objects, or 2020-W01
  date: '2020-01-01',
});

// get daily downloads for a package during the last 30 available days
await client.getDailyDownloadsForLastMonth({
  packages: ['@aws-lambda-powertools/logger'],
});
```

The client supports all the methods exposed by the [npm API](https://github.com/npm/registry/blob/master/docs/download-counts.md). Check out the [API documentation](https://dreamorosi.github.io/npm-registry-analytics/classes/NpmRegistryClient.html) for a full list of available methods.

## License

This library is licensed under the MIT-0 License. See the [LICENSE](./LICENSE) file.

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