import type { LookupFunction } from '../../../lib/ssrf/guardedLookup.js'; /** Redirects followed for one image (§ 10). */ export declare const MAX_REDIRECTS = 3; export interface ImageDownloaderOptions { /** `system.import.allowPrivateNetworks`: a test switch (§ 4.5, point 9). */ allowPrivate: () => boolean; /** The DNS lookup. A test passes a fake. */ lookup?: LookupFunction; /** The deadline for one image, redirects included (`imageTimeoutSeconds`). */ timeoutMs: number; /** The types the store accepts for uploads (`getAllowedMimeTypes`). */ allowedTypes: () => readonly string[]; /** The size limit for a type, in bytes (`getMaxUploadFileSizeMbForType`). */ maxBytesForType: (contentType: string) => number; } export interface DownloadedImage { bytes: Buffer; contentType: string; /** The address after the redirects. */ finalUrl: string; } export interface ImageDownloader { /** Reads the image. Throws `ImageError`. */ download(url: string): Promise; /** * Checks that the image can be reached, without reading its body: `HEAD`, and * when the server refuses it (405, 501) a `GET` of the first byte. */ probe(url: string): Promise; close(): Promise; } export declare function createImageDownloader(options: ImageDownloaderOptions): ImageDownloader;