/** * Writing a run's output so a failed run leaves the destination as it found it. * * The output is written to `.partial` beside the destination and renamed * over it only once the run has finished; a run that fails removes the partial * file and never touches the destination. The rename is within one directory, * so within one filesystem, and therefore atomic: a reader sees the old file or * the new one, never half of either. * * Measured before this module, on all five implementations: a run that failed * with `-o out.csv` truncated an existing `out.csv` to nothing — the output of * the previous, successful run gone — and one of the five deleted it outright. * Parquet was already written this way ("TDC never writes a corrupt file"); text * now is too. * * A symbolic link is resolved first and its TARGET written, so the link stays a * link. A destination that exists and is not a regular file (`-o /dev/stdout`, a * named pipe) cannot be replaced by a rename, so it is written directly — and so * is one whose directory refuses a file beside it (`/dev/stdout` redirected to a * file resolves to `/dev/fd/1`, a regular file in a directory nothing can be * created in). Both are written exactly as they were before this module. */ /** The partial file beside a destination. */ export declare function partialPath(path: string): string; /** `produce` writes to the descriptor it is given; the destination changes only if it returns. */ export declare function writeAtomicallySync(path: string, produce: (fd: number) => void): void; /** The same, for a producer that awaits. */ export declare function writeAtomically(path: string, produce: (fd: number) => Promise): Promise; //# sourceMappingURL=atomic-write.d.ts.map