import type { BufferEncoding, FilehandleOptions, GenericFilehandle, ProgressCallback, ReadFileOptions, ReadFileTextOptions, Stats } from './filehandle.ts'; export default class RemoteFile implements GenericFilehandle { protected url: string; /** the URL this handle fetches — see {@link GenericFilehandle.source} */ get source(): string; private _stat?; private statProbe?; private fetchImplementation; private baseHeaders; private baseOverrides; private baseSignal?; constructor(source: string, opts?: FilehandleOptions); protected buildRequest(opts: FilehandleOptions, extraHeaders?: Record): RequestInit; fetch(input: RequestInfo, init?: RequestInit): Promise; read(length: number, position: number, opts?: FilehandleOptions): Promise>; /** * The bytes for one byte range — the seam a subclass that can serve those * bytes some other way overrides. * * The alternative is overriding {@link fetch}, and for a subclass holding a * byte cache that is the wrong altitude: it has bytes, so it has to wrap them * in a `Response` that `read` immediately unwraps again. Both halves copy. * Measured against JBrowse's `RemoteFileWithRangeCache` on a fully warm cache * with no network at all, that round trip was **69-77% of the entire read** — * 6.15ms vs 1.90ms for 16MB, and the same ratio down to 256KB. * * So: override this to serve bytes, override {@link fetch} to change how * requests are made. Overriding neither leaves the ranged GET below, and the * default implementation still goes through `this.fetch`, so a subclass that * only wraps `fetch` keeps working untouched. */ protected fetchBytes(length: number, position: number, opts: FilehandleOptions): Promise>; private checkOk; readFile(options?: ReadFileOptions): Promise>; readFile(options: ReadFileTextOptions): Promise; /** * Reads the body of a whole-file response. A subclass overrides it to learn * when that body starts and ends, which `fetch` cannot tell it: `fetch` * returns at the headers. */ protected readFileBody(res: Response, encoding: BufferEncoding | undefined, onProgress?: ProgressCallback): Promise>; stat(): Promise; close(): Promise; }