@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
17 lines • 1.09 kB
TypeScript
import { type ByteSource } from '../../io/types.ts';
import type { RAMAccessor } from '../../accessor/ram.ts';
import { type PathSpec } from '../../types.ts';
/**
* Replace a file's bytes, or add them to its end. Bytes land at once, as does
* a stream under `atomic`, staged until it ends. Any other stream lands as it
* arrives, so a reader watches the file grow: what has arrived lands within
* `STREAM_PUBLISH_SECONDS`, a writer gone quiet included, and at the end, a
* replacement at its own position, as an open file's offset keeps it, an
* append at the file's end then, so another appender's bytes stay. Appending
* nothing opens the file (`true >> f`): it creates a missing one and leaves an
* existing one as it was, modification time included. A device that discards
* writes (`/dev/null`) has its bytes counted as they arrive and kept nowhere.
* Mirrors Python's `write`.
*/
export declare function write(accessor: RAMAccessor, path: PathSpec, data: ByteSource, append?: boolean, signal?: AbortSignal, atomic?: boolean): Promise<void>;
//# sourceMappingURL=write.d.ts.map