/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Download + manifest plumbing for the `mailwoman corpus fetch ` family — one download-with-retry and * one MANIFEST.json idiom instead of the per-script clones the 2026-07-09 dedupe survey counted * (6× `downloadToFile`, 2× `isTransientStatus`, 9× manifest writes). */ /** * The option base every `mailwoman corpus fetch ` module extends. */ export interface BaseFetchOptions { /** * Destination root for downloaded source data. Each source writes its own subdirectory. */ outRoot: string; } /** * The per-run result every fetch module returns; the command maps `failed > 0` to exit code 1. */ export interface FetchSummary { fetched: number; skipped: number; failed: number; failedCodes: string[]; } /** * A status worth retrying: rate limiting or a server-side failure. */ export declare function isTransientStatus(status: number): boolean; export interface DownloadOptions { url: string; dest: string; /** * Per-attempt timeout. Default 10 minutes — these are multi-GB government dumps. */ timeoutMs?: number; /** * Extra attempts after the first, taken only on transient statuses or network errors. Default 0. */ retries?: number; /** * Delay between attempts. Default 5s. */ retryDelayMs?: number; headers?: Record; report?: (line: string) => void; } /** * Download `url` to `dest` with per-attempt timeout and transient-status retry. Throws on a non-transient HTTP status * or once retries are exhausted. Returns the byte count written. */ export declare function downloadToFile(options: DownloadOptions): Promise<{ bytes: number; }>; /** * Read a MANIFEST.json; `null` when missing or corrupt (callers re-fetch from scratch). */ export declare function readManifest(path: string): Promise; /** * Load manifest entries into a map so untouched keys survive a partial re-fetch. */ export declare function loadManifestEntries(path: string, key: (entry: T) => string): Promise>; /** * Write a MANIFEST.json in the house shape: pretty-printed, trailing newline. */ export declare function writeManifest(path: string, manifest: unknown): Promise; //# sourceMappingURL=download.d.ts.map