import { GumletError } from '../../core/error'; /** * The most a buffered (non-streaming) response body may hold, counted after transparent * decompression. A body handed to the caller as a stream or a binary `Response` is not capped. */ export declare const MAX_RESPONSE_BODY_BYTES: number; /** The most of an error body the client reads for its message; anything after it is dropped. */ export declare const MAX_ERROR_BODY_BYTES: number; /** The most a stream decoder holds for one pending line, event or frame before it gives up. */ export declare const MAX_STREAM_PENDING_BYTES: number; /** The error a decoder or body read throws when the server sends more than `limit` bytes for one value. */ export declare const sizeLimitError: (what: string, limit: number) => GumletError; /** * Reads a response body as UTF-8 text, never holding more than `limit` bytes of it. * * `response.text()` buffers whatever the server sends, so a hostile or broken server could make the * process hold gigabytes. Past `limit`, `'error'` throws (a success body cut short would only parse * wrong) and `'truncate'` keeps what was read (an error message is still useful in part). */ export declare function readBodyText(response: Response, limit: number, overflow?: 'error' | 'truncate'): Promise; /** * Leaves a request's deadline armed until its buffered body has been read, so a server that sends * headers promptly and then trickles the body is still cut off at the timeout. */ export declare const holdDeadline: (controller: AbortController, release: () => void) => void; /** Disarms the deadline {@link holdDeadline} left armed for this request, if any. */ export declare const releaseDeadline: (controller: AbortController) => void; /** * Runs a buffered body read under the request deadline, disarming it once the read settles. * * A read the deadline aborted rejects with a bare `AbortError`; it is reported as the timeout it was. * One the caller's own signal aborted is left as it is. */ export declare function readUnderDeadline(props: { controller: AbortController; options: { signal?: AbortSignal | null | undefined; }; }, read: () => Promise): Promise; //# sourceMappingURL=body.d.ts.map