@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
36 lines • 1.77 kB
TypeScript
import type { GDriveAccessor } from '../../accessor/gdrive.ts';
import { type FileStat, type PathSpec } from '../../types.ts';
import type { DriveApi } from './api.ts';
export declare function readFileVersioned(drive: DriveApi, fileId: string, virtual: string, entry: FileStat, offset?: number, size?: number | null): Promise<Uint8Array>;
/**
* What is at the file `path`, as its parent's listing named it. Rejects
* ENOENT when nothing is there and EISDIR when a folder is. Mirrors Python's
* `file_entry`.
*/
export declare function fileEntry(path: PathSpec, entry: FileStat | null | undefined): FileStat;
/**
* Read a Drive file, optionally only a byte range of it.
*
* Only a binary file has a remote range to ask for. A google-apps file
* is rendered here into JSON, so its bytes do not exist until we make
* them and the window can only be taken afterwards.
*
* Args:
* accessor: Drive 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: GDriveAccessor, path: PathSpec, options?: {
offset?: number;
size?: number;
}, entry?: FileStat | null): Promise<Uint8Array>;
/**
* Stream a Drive file as it downloads. A google-apps file exists only once
* rendered, so it comes in one chunk, as `read` gives it. A binary file is
* stamped as `readFileVersioned` stamps a whole read, once the last chunk is
* in and checked against the md5 Drive gave: a stream abandoned part-way
* stamps nothing. Mirrors Python's `read_stream`.
*/
export declare function readStream(accessor: GDriveAccessor, path: PathSpec, entry?: FileStat | null): AsyncGenerator<Uint8Array, void>;
//# sourceMappingURL=read.d.ts.map