query-registry
Version:
Query the npm registry for packuments, manifests, packages and download counts
24 lines (21 loc) • 1.04 kB
TypeScript
import * as z from "zod";
import type { DownloadPeriod } from "./download-period.js";
export declare const PackageDownloads: z.ZodObject<{
package: z.ZodString;
downloads: z.ZodNumber;
start: z.ZodString;
end: z.ZodString;
}, z.core.$strip>;
/**
`PackageDownloads` describes the total number of downloads for a package in a given time period.
@see {@link https://github.com/npm/registry/blob/master/docs/download-counts.md#point-values}
*/
export type PackageDownloads = z.infer<typeof PackageDownloads>;
/**
`getPackageDownloads` returns the total number of downloads for a package in the given time period.
@param name - package name
@param period - {@link DownloadPeriod | time period} in which downloads happened; the npm registry limits data to the last 18 months
@param registry - URL of the registry downloads API (default: npm registry downloads API)
@see {@link PackageDownloads}
*/
export declare function getPackageDownloads(name: string, period: DownloadPeriod, registry?: string): Promise<PackageDownloads>;