We use this URL to get the number of npm package downloads.
https://api.npmjs.org/downloads/point/${start}:${end}/${packageName}
npm i @yunseorim1116/npm-pack-count
yarn add @yunseorim1116/npm-pack-count
pnpm i @yunseorim1116/npm-pack-count
- make it possible to get the number of downloads for multiple packages instead of just one package (ex: packages a, b)
- show total weekly and monthly package downloads by package. (ex: weekly package downloads of A, weekly package downloads of B)
- shows the total weekly and monthly downloads of packages a and b combined.
- set the default option (one week from yesterday excluding the current date), You can also optionally input the desired weekly unit (ex: Monday-Sunday).
- Shows the total number of downloads for all packages.
(async () => {
const packages = ['axios', '@types/axios'];
const numberOfWeeks = 6;
// The first argument is an array of package names, the second argument is the desired number of weeks
const tracker = new DownloadTracker(packages, numberOfWeeks);
const datas = await tracker.start();
console.log(datas);
})();