@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
31 lines • 1.24 kB
TypeScript
import type { BoxAccessor } from '../../accessor/box.ts';
import { type FileStat, type PathSpec } from '../../types.ts';
/**
* Read a file, optionally only a byte range of it. On a `write: conditional`
* mount a whole read stamps its bytes' own sha1, even through an outdated
* listing row.
*
* Args:
* accessor: Box accessor.
* path: the path to read.
* options: `{offset, size}`, the byte window, or absent for the whole file.
* entry: what is at the path.
*/
export declare function read(accessor: BoxAccessor, path: PathSpec, options?: {
offset?: number;
size?: number;
}, entry?: FileStat | null): Promise<Uint8Array>;
/**
* Stream a file, stamped with its sha1 once it has been read whole. When a
* token can result (a recorder is bound and the row has a sha1), each chunk
* feeds a running SHA-1; the token lands only after the last chunk, so a
* stream abandoned part-way stamps nothing. The token is chosen as `read`
* chooses it.
*
* Args:
* accessor: Box accessor.
* path: the path to read.
* entry: what is at the path.
*/
export declare function readStream(accessor: BoxAccessor, path: PathSpec, entry?: FileStat | null): AsyncIterable<Uint8Array>;
//# sourceMappingURL=read.d.ts.map