export type BufferEncoding = "utf-8" | "utf8" | "ascii" | "latin1" | "binary" | "ucs2" | "ucs-2" | "utf16le" | "utf-16le"; /** * Operations surface for atomic writes. Mirrors the subset of * {@link WriteOperations} needed so that tests can stub the filesystem. */ export interface AtomicWriteOperations { writeFile: (absolutePath: string, data: string) => Promise; rename: (oldPath: string, newPath: string) => Promise; unlink: (absolutePath: string) => Promise; } declare const defaultAtomicWriteOperations: AtomicWriteOperations; /** * Write `content` to `absolutePath` atomically by first writing to a sibling * temp file in the same directory and then renaming it into place. `rename` * is atomic when source and destination live on the same filesystem, which is * guaranteed because the temp file is a sibling of the destination. * * If the temp write or rename fails, the temp file is best-effort removed so * no stale partial temp file is left behind. The original file (if any) is * never touched until the rename succeeds, so a failed write leaves the * existing file intact. * * @param absolutePath Final destination file path. * @param content Text content to write. * @param encoding Encoding for the temp write (defaults to "utf-8"). * @param operations Optional stub for tests; defaults to real `fs/promises`. */ export declare function atomicWriteFile(absolutePath: string, content: string, encoding?: BufferEncoding, operations?: AtomicWriteOperations): Promise; export { defaultAtomicWriteOperations }; //# sourceMappingURL=atomic-write.d.ts.map