all-package-names
Version:
Fast lookup and iteration over all NPM package names
24 lines • 916 B
TypeScript
import type { PackageNameDB, PackageNameDBOptions } from "./types.ts";
/**
* File-backed package-name database.
*
* Lookup and iteration operate directly on `names.json`; only `toArray()`
* parses the full file into memory.
*/
export declare class AllPackageNames implements PackageNameDB {
private readonly namesPath;
private readonly manifestPath;
constructor(options?: PackageNameDBOptions);
/**
* Returns true if the package name exists in the database.
*
* Runs a binary search to quickly find the package name without loading the full file into memory.
*/
has(name: string): Promise<boolean>;
toArray(): Promise<string[]>;
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
iterPrefix(prefix: string): AsyncIterable<string>;
refresh(): Promise<import("../sync/index.ts").SyncResult>;
private withFile;
}
//# sourceMappingURL=index.d.ts.map