@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
25 lines • 1.4 kB
TypeScript
import { type PathSpec } from '../../types.ts';
import type { S3Accessor } from '../../accessor/s3.ts';
export declare function readStream(accessor: S3Accessor, path: PathSpec, onVersion?: (version: string | null) => void): AsyncIterable<Uint8Array>;
/**
* A byte window, taken the cheapest way the configured client allows.
*
* The SDK path asks for one ranged GET, which is the whole point on an object
* store. The browser path cannot: `createBrowserS3Client` fetches a presigned
* URL, and a presigned GET carries no `Range` — adding the header would make
* the request non-simple and trip a CORS preflight that presigned deployments
* generally do not allow. Its shim therefore refuses a `Range` input outright,
* so asking for one there would fail rather than quietly return the whole
* object as if it were the window.
*
* Streaming is the honest substitute: `bodyFromResponse` hands back a reader
* over the live body, so stopping at `offset + size` cancels the download
* instead of buffering the rest of the object and throwing it away.
*
* @param accessor the S3 accessor
* @param path the object path
* @param offset first byte to read
* @param size how many bytes, or null for the rest of the object
*/
export declare function readRange(accessor: S3Accessor, path: PathSpec, offset: number, size: number | null): Promise<Uint8Array>;
//# sourceMappingURL=stream.d.ts.map