Skip to main content

Module file

Module file 

Source
Expand description

Whole-file writes that a crash or a concurrent writer cannot leave half done: the contents go to a temporary file beside the target, are synced, and only then take the target’s name.

Enums§

Access
Who may read a file written here.

Functions§

replace
Writes contents to path, replacing any file there, atomically: a rename of a synced temporary file, so a reader sees the old contents or the new, never part of either. Parent directories are created.
write_new
Writes contents to path unless a file is there, atomically: a hard link from a synced temporary file, which fails when path exists, so an existing file is never replaced and of two concurrent writers exactly one wins. Parent directories are created.