npm-registry-analytics
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

npm-registry-analytics

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

Install

npm i npm-registry-analytics@latest

Usage

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. Check out the API documentation for a full list of available methods.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

Package Sidebar

Install

npm i npm-registry-analytics

Weekly Downloads

1

Version

1.0.0

License

MIT-0

Unpacked Size

119 kB

Total Files

7

Last publish

Collaborators

  • dreamorosi