async function

getDailyPackageDownloads

(__namedParameters,[object Object]): Promise<DailyPackageDownloads>
getDailyPackageDownloads returns the number of downloads for a package for each day in a given time period.

Examples

Get the day by day weekly downloads for package query-registry from the npm registry:
import { getDailyPackageDownloads } from 'query-registry';

(async () => {
    const downloads = await getDailyPackageDownloads({ name: 'query-registry' });

    // Output: 'query-registry'
    console.log(downloads.package);

    // Output: 'number'
    console.log(typeof downloads.downloads[0].downloads);
})();
Get the day by day monthly downloads for package query-registry from the npm registry:
import { getDailyPackageDownloads } from 'query-registry';

(async () => {
    const downloads = await getDailyPackageDownloads({ name: 'query-registry', period: 'last-month' });

    // Output: 'query-registry'
    console.log(downloads.package);

    // Output: 'number'
    console.log(typeof downloads.downloads[0].downloads);
})();