/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * @file Downloads one zip archive through an {@linkcode APIClient} and answers what arrived. * * An INSPIRE ATOM service that publishes one archive per area is harvested through many small * requests rather than through one large transfer, so the transfer runs on the client the harvest * already paces and a test can drive it over a stubbed transport. `downloadToFile` runs on global * `fetch`, which a unit test cannot intercept. * * The body is checked against the zip local-file-header signature rather than against a length. * Two publishers answer a withdrawn or misspelled path with an html page under http 200, and the * advertised media type does not settle what arrived either: ČÚZK advertises * `application/gml+xml` on a body it serves as `application/zip`, and the Dirección General del * Catastro advertises `application/atom+xml` on its zipped GML. The signature is the one statement * the body itself makes. */ import type { APIClient } from "@mailwoman/core/api"; import type { PathBuilderLike } from "path-ts"; /** * What one archive transfer delivered. */ export interface ZipArchiveDownload { /** * The byte count of the delivered body, counted rather than read from a header or a feed. * * An INSPIRE feed's `length` attribute is a claim: Denmark's understates its file by * 23 times, and Navarra states the same 34,987 on all 272 of its partitions. */ bytes: number; sha256: string; /** * The `Last-Modified` the host served the archive under, or `null` where it served none. */ lastModified: string | null; } export interface DownloadZipArchiveOptions { url: string; dest: PathBuilderLike; /** * Per-request timeout, in milliseconds. */ timeout?: number; signal?: AbortSignal; } /** * Downloads one zip archive to `dest` and answers its byte count, digest and served modification time. * * @throws When the body does not begin with a zip signature, so an html error page * is never written to disk under an archive's name. */ export declare function downloadZipArchive(client: Pick, options: DownloadZipArchiveOptions): Promise; //# sourceMappingURL=zip-archive.d.ts.map