runtime/fs.ts

File system utilities.

Declarations
#

view source

write_file_atomic
#

runtime/fs.ts view source

(deps: Pick<FsWriteDeps, "write_text_file" | "rename">, path: string, content: string): Promise<void>

Write a file atomically via temp file + rename.

Writes to <path>.tmp then renames over path so readers either see the old contents or the full new contents — never a partial write.

deps

type Pick<FsWriteDeps, "write_text_file" | "rename">

path

type string

content

type string

returns

Promise<void>

throws

  • Error - if `write_text_file` or `rename` rejects (permissions, disk full, cross-device rename, etc.)

Imported by
#