npm-registry-analytics
v1.0.0
Published
An opinionated client for the npm package download counts API written in TypeScript
Downloads
4
Maintainers
Readme
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.