import type { BaseFetchOptions, FetchSummary } from "#tools/fetch/download"; export interface FetchGeonamesDumpOptions extends BaseFetchOptions { /** * ISO alpha-2 codes, any casing. * * Absent → every country `countryInfo.txt` enumerates. */ countries?: readonly string[] | null; /** * Dump directory to read from. * * Exists so the 404 and coverage behavior can be exercised against a local server. * * @defaultValue GeoNames' own. */ baseURL?: string; /** * Refetch a dump whose `.txt` already exists. * * @defaultValue `false` — the tool fills gaps */ force?: boolean; } interface GeonamesDumpFileEntry { country: string; filename: string; source_url: string; sha256: string; bytes: number; } export interface GeonamesDumpManifest { source: string; base_url: string; license: string; attribution: string; downloaded_at: string; files: GeonamesDumpFileEntry[]; /** * `.txt` files already on disk and leaves unchanged — the hand-fetched population this tool extends. */ skipped_present: string[]; /** * Countries in the source catalog that the source's dump directory nonetheless 404s. * * A fact about the source, recorded so a later reader doesn't spend the fetch to rediscover it. */ unavailable: string[]; /** * Present `.txt` files that are not 19-column gazetteer dumps. * GeoNames' postal exports share the same basename. * * Left in place (this tool never overwrites data it didn't fetch). * The fix is to move the file to its own home and rerun. */ wrong_format_present: string[]; } /** * True when the first non-empty line contains the gazetteer dump's 19 tab-separated columns. * * Accepts a partial head read. * The first line is the whole question, so callers need not hand it a resident 350 MB dump. * * Walk the string directly instead of constructing a spliterator. * The capitals builder already holds each country dump as a string. * * A byte-oriented spliterator would UTF-8 encode that input and allocate up to * another 350 MB only to inspect the first non-empty line. */ export declare function looksLikeGazetteerDump(text: string): boolean; /** * Parse the ISO codes (column 1) and capital names (column 6) out of `countryInfo.txt`. * `#`-prefixed lines are the file's own commentary. */ export declare function parseCountryInfo(text: string): Array<{ country: string; capital: string; }>; /** * Download `countryInfo.txt` and each missing `.zip`. * * Extract each dump to `/.txt` beside the hand-fetched files. * The `manifest.json` lists fetched countries. * * It also lists countries skipped because their files were already present * and countries unavailable from the source. */ export declare function fetchGeonamesDumps(options: FetchGeonamesDumpOptions, report?: (line: string) => void): Promise; export {}; //# sourceMappingURL=dump.d.ts.map