async function

getRegistryDownloads

(__namedParameters,[object Object]): Promise<RegistryDownloads>
getRegistryDownloads returns the number of downloads for all registry packages in a given time period.

Examples

Get the weekly downloads for the npm registry:
import { getRegistryDownloads } from 'query-registry';

(async () => {
    const downloads = await getRegistryDownloads();

    // Output: 'number'
    console.log(typeof downloads.downloads);
})();
Get the monthly downloads for the npm registry:
import { getRegistryDownloads } from 'query-registry';

(async () => {
    const downloads = await getRegistryDownloads({ period: 'last-month' });

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