@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
42 lines • 2.66 kB
TypeScript
import type { TiDBFilesystemAccessor } from '../../accessor/tidb_filesystem.ts';
import { ByteSpool } from '../../io/spool.ts';
import type { ByteWindow } from '../../utils/ranges.ts';
import type { Entry } from './types.ts';
/**
* One path's metadata, from a HEAD. drive9 keeps a file and a directory of
* one name apart: the bare path answers the file when there is one, and the
* path with a trailing slash answers the directory.
*/
export declare function statEntry(accessor: TiDBFilesystemAccessor, remotePath: string, directory?: boolean): Promise<Entry>;
/**
* Each path's metadata, null for a missing one, in as few requests as
* fs:batch-stat allows.
*/
export declare function statEntries(accessor: TiDBFilesystemAccessor, remotePaths: readonly string[]): Promise<(Entry | null)[]>;
export declare function listEntries(accessor: TiDBFilesystemAccessor, remotePath: string): Promise<Entry[]>;
/**
* A file's bytes. A large file answers with a redirect to its object, which
* fetch follows with the Range and without the token.
*/
export declare function download(accessor: TiDBFilesystemAccessor, remotePath: string, window?: ByteWindow): Promise<Uint8Array>;
export declare function downloadStream(accessor: TiDBFilesystemAccessor, remotePath: string): AsyncIterable<Uint8Array>;
/**
* Replace a file's bytes: one PUT below the inline threshold, a multipart
* upload through presigned part URLs from it on, each part read from `data`
* as it goes up.
*/
export declare function upload(accessor: TiDBFilesystemAccessor, remotePath: string, data: Uint8Array | ByteSpool): Promise<void>;
/**
* Add bytes to the end of a file drive9 keeps in object storage. The server
* copies the parts the bytes leave alone into a new upload, the last part's
* own bytes come back through its read URL, and they go up again with the
* new ones. False, with nothing sent, for a file drive9 keeps inline (400) or
* a path that is not a file (404).
*/
export declare function appendTo(accessor: TiDBFilesystemAccessor, remotePath: string, data: Uint8Array | ByteSpool): Promise<boolean>;
export declare function makeDirectory(accessor: TiDBFilesystemAccessor, remotePath: string): Promise<void>;
/** Remove one entry of the given kind; a directory must be empty. */
export declare function remove(accessor: TiDBFilesystemAccessor, remotePath: string, kind: 'file' | 'dir'): Promise<void>;
export declare function removeTree(accessor: TiDBFilesystemAccessor, remotePath: string): Promise<void>;
export declare function move(accessor: TiDBFilesystemAccessor, remoteSrc: string, remoteDst: string): Promise<void>;
//# sourceMappingURL=client.d.ts.map