Documentation
¶
Overview ¶
Package fsatomic provides crash-safe single-file persistence: data is written to a temp file in the target directory, synced to disk, and then atomically moved over the target. On Windows, where rename-over-existing is not atomic, the existing file is shuffled to a .bak first and restored on failure; readers that care about mid-replace crashes can fall back to that .bak.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteFile ¶
WriteFile atomically replaces path with data. The temp file is created in path's directory so the final rename never crosses filesystems. On POSIX, both the file and the parent directory are synced so the renamed directory entry is durable after return. Replacement files keep os.CreateTemp's private permissions; perm is accepted for parity with os.WriteFile but is never used to widen access beyond the process umask.
Types ¶
This section is empty.