import type { BufferEncoding, FilehandleOptions, ProgressCallback } from './filehandle.ts'; export declare function toBytes(src: Response | Blob): Promise>; /** * The body of a `readFile()`, decoded per the caller's encoding. * * Shared by RemoteFile and BlobFile because the branch is the same in both: * text for utf8, bytes for no encoding, an error for an encoding neither can * decode. Both spellings of utf8 count — node's `readFile` accepts `utf-8`, so * LocalFile does too, and rejecting it only here would make the encoding a * property of which filehandle you happened to hold. */ export declare function readBody(src: Response | Blob, encoding: BufferEncoding | undefined, onProgress?: ProgressCallback): Promise | string>; /** * `readFile()` takes either a bare encoding string or an options object, in * every implementation. Split whichever was passed into the two things callers * actually branch on. */ export declare function splitReadFileOptions(options: FilehandleOptions | BufferEncoding | undefined): { encoding?: BufferEncoding; opts: FilehandleOptions; }; /** * Total file size from a `Content-Range: bytes 0-9/1234` header, or undefined * if the header is absent or gives the size as `*`. */ export declare function parseContentRangeSize(contentRange: string | null): number | undefined; /** * Content-Length as a usable byte count. A malformed header yields undefined * rather than NaN, which would otherwise survive an `=== undefined` check and * poison every arithmetic use downstream. */ export declare function parseContentLength(res: Response): number | undefined; /** * Read a Response body to bytes while reporting download progress. * * When Content-Length is known the body is streamed directly into one pre-sized * buffer (no per-chunk array, no second copy), ticking `onProgress` as chunks * arrive. Without a known length there is no fraction to show, so it falls back * to a single one-shot read and one completion tick rather than buffering * chunks. Only used when a caller opts in via `onProgress`; the plain {@link * toBytes} fast path is unaffected. */ export declare function toBytesWithProgress(res: Response, onProgress: ProgressCallback): Promise>;