export interface AtomicWriteOptions { /** * 文件权限(如 0o600 密钥 / 0o755 可执行脚本)。设置在 tmp 上,rename 后保留。 * 严格生效:creation mode 会被 umask 截断(umask 077 下 0o755 落成 0o700), * 故写后再显式 chmod 到精确值——创建时仍传 mode 保证文件从不以比目标更宽的 * 权限存在过(截断只会更紧),chmod 再放宽到精确值。 */ mode?: number; /** 文本编码,默认 utf-8(data 为 Buffer 时忽略)。 */ encoding?: BufferEncoding; /** * Crash-durable write: fsync the completed temp file before rename, then * fsync the containing directory so the new directory entry survives a * power loss. This costs extra I/O and is therefore opt-in for credentials * and other recovery journals whose acknowledgement depends on persistence. */ durable?: boolean; /** * Preserve the historical dotfiles behavior of following an existing target * symlink. Credential/authority files must set this to false: the containing * directory is canonicalized, but the leaf is replaced rather than followed. */ followTargetSymlink?: boolean; } /** * 原子写(同步):写同目录唯一 tmp → rename 覆盖目标。 * 任何失败都不会影响目标文件的旧内容;tmp 残留会被 best-effort 清理。 */ export declare function atomicWriteFileSync(filePath: string, data: string | Buffer, options?: AtomicWriteOptions): void; /** * 原子写(异步):语义同 atomicWriteFileSync,给 async 调用链(workflow 运行时等)。 */ export declare function atomicWriteFile(filePath: string, data: string | Buffer, options?: AtomicWriteOptions): Promise; //# sourceMappingURL=atomic-write.d.ts.map