/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * @file Retries and resumes interrupted corpus downloads. */ import type { PathBuilderLike } from "path-ts"; /** * Run one transfer up to `1 + retries` times, pausing `retryDelayMs` between attempts. * * A portal that drops a long connection would otherwise lose a whole collection fetch to one file. * The last error is rethrown so the caller can name the file it lost. */ export declare function withRetries(transfer: () => Promise, options?: { retries?: number; retryDelayMs?: number; report?: (line: string) => void; label?: string; }): Promise; /** * Download `url` to `dest` in ranges, resuming from whatever the `.tmp` sibling already holds. * * The total comes from the first `Content-Range`, and the loop gives up after `maxConnections` * connections so a host that keeps answering 206 with no bytes cannot spin. * * Answers the byte count written and throws when the host answers anything but 206 for a range. */ export declare function resumableDownload(options: { url: string; dest: PathBuilderLike; headers?: Record; maxConnections?: number; retryDelayMs?: number; report?: (line: string) => void; }): Promise; /** * The `Set-Cookie` values of a response folded into one `Cookie` header, * so a second request reuses the session the first opened. */ export declare function cookieHeader(res: Response): string; /** * The file name a `Content-Disposition: attachment` header names, RFC 5987 form (`filename*=utf-8''…`) * first, plain `filename="…"` second, or `fallback` when the header includes neither. */ export declare function attachmentFilename(res: Response, fallback: string): string; //# sourceMappingURL=retry.d.ts.map