import { type IncomingMessage } from 'http';
import { type FetchResult, type FetchOptions } from '@pnpm/fetcher-base';
import { type Cafs } from '@pnpm/cafs-types';
import { type FetchFromRegistry } from '@pnpm/fetching-types';
export interface HttpResponse {
    body: string;
}
export type DownloadOptions = {
    getAuthHeaderByURI: (registry: string) => string | undefined;
    cafs: Cafs;
    registry?: string;
    onStart?: (totalSize: number | null, attempt: number) => void;
    onProgress?: (downloaded: number) => void;
    integrity?: string;
} & Pick<FetchOptions, 'pkg' | 'appendManifest' | 'readManifest' | 'filesIndexFile'>;
export type DownloadFunction = (url: string, opts: DownloadOptions) => Promise<FetchResult>;
export interface NpmRegistryClient {
    get: (url: string, getOpts: object, cb: (err: Error, data: object, raw: object, res: HttpResponse) => void) => void;
    fetch: (url: string, opts: {
        auth?: object;
    }, cb: (err: Error, res: IncomingMessage) => void) => void;
}
export interface CreateDownloaderOptions {
    retry?: {
        retries?: number;
        factor?: number;
        minTimeout?: number;
        maxTimeout?: number;
        randomize?: boolean;
    };
    timeout?: number;
    fetchMinSpeedKiBps?: number;
}
export declare function createDownloader(fetchFromRegistry: FetchFromRegistry, gotOpts: CreateDownloaderOptions): DownloadFunction;
