@sema-agent/core
Version:
Stateless, task-oriented AI agent core
10 lines (9 loc) • 966 B
TypeScript
/** Make the file at `path` durable: opened for writing without creating or truncating it (and, where the platform has `O_NOFOLLOW`,
* without following a symbolic link at `path` — a link there throws; Windows has none and follows it, as every sync here did before),
* synced, closed. Every failure throws: a caller that asks for durability goes on only once it holds. */
export declare function fsyncFile(path: string): void;
/** fsync a directory entry so a rename/create in it is itself durable (best-effort: some platforms reject
* opening a dir, in which case the rename is still namespace-atomic, just not directory-fsync'd).
* `required`: for a step that must not go on unless what it just created is durable — any failure to open or sync throws; Windows,
* which has no directory sync, is not asked (what was created there is as durable as its rename). */
export declare function fsyncDir(dir: string, mode?: "best-effort" | "required"): void;