import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; import { Readable } from 'stream'; export interface SaveOptions { compress?: boolean; bodyOnly?: boolean; } export interface ResponseInit { url: string; requestUrl: string; statusCode: number; headers: IncomingHttpHeaders | OutgoingHttpHeaders; httpVersion: string; body: Buffer; fetchStart: Date; fetchEnd: Date; redirects?: string[]; } export interface StreamResponseInit extends Omit { body: Readable; } export declare class ResponseMetadata { readonly url: string; readonly requestUrl: string; readonly statusCode: number; readonly headers: IncomingHttpHeaders; readonly httpVersion: string; readonly fetchStart: Date; readonly fetchEnd: Date; readonly redirects: string[]; constructor(init: Omit); get ok(): boolean; get redirected(): boolean; get contentEncoding(): string; get contentType(): string; get fetchDuration(): number; header(name: string): string | undefined; headerValues(name: string): string[]; } export declare class Response extends ResponseMetadata { readonly body: Buffer; constructor(init: ResponseInit); get contentMD5(): string; get contentLength(): number; text(encoding?: BufferEncoding): string; json(): T; save(path: string, options?: SaveOptions): Promise; static load(path: string): Promise; } export declare class StreamResponse extends ResponseMetadata { readonly body: Readable; constructor(init: StreamResponseInit); get contentLength(): number | undefined; buffer(): Promise; text(encoding?: BufferEncoding): Promise; json(): Promise; toResponse(): Promise; save(path: string, options?: SaveOptions): Promise; }