UNPKG

1.76 kBTypeScriptView Raw
1import { DownloadPeriod } from '../types/download-period';
2import { DailyRegistryDownloads } from '../types/downloads';
3/**
4 * `getDailyRegistryDownloads` returns the number of downloads for all registry packages
5 * for each day in a given time period.
6 *
7 * @param period - time period in which downloads happened (default: `last-week`)
8 * @param registryDownloadsAPI - URL of the registry's downloads API (default: npm registry)
9 * @param cached - accept cached responses (default: `true`)
10 *
11 * @example
12 * Get the day by day weekly downloads for the npm registry:
13 *
14 * ```typescript
15 * import { getDailyRegistryDownloads } from 'query-registry';
16 *
17 * (async () => {
18 * const downloads = await getDailyRegistryDownloads();
19 *
20 * // Output: 'number'
21 * console.log(typeof downloads.downloads[0].downloads);
22 * })();
23 * ```
24 *
25 * @example
26 * Get the day by day monthly downloads for the npm registry:
27 *
28 * ```typescript
29 * import { getDailyRegistryDownloads } from 'query-registry';
30 *
31 * (async () => {
32 * const downloads = await getDailyRegistryDownloads({ period: 'last-month' });
33 *
34 * // Output: 'number'
35 * console.log(typeof downloads.downloads[0].downloads);
36 * })();
37 * ```
38 *
39 * @see {@link DailyRegistryDownloads}
40 * @see {@link DownloadPeriod}
41 * @see {@link npmRegistryDownloadsAPI}
42 * @see {@link https://github.com/npm/registry/blob/master/docs/download-counts.md#ranges}
43 */
44export declare function getDailyRegistryDownloads({ period: rawDownloadPeriod, registryDownloadsAPI, cached, }?: {
45 period?: DownloadPeriod;
46 registryDownloadsAPI?: string;
47 cached?: boolean;
48}): Promise<DailyRegistryDownloads>;
49//# sourceMappingURL=get-daily-registry-downloads.d.ts.map
\No newline at end of file