Expand description
Common persistence helpers: atomic JSON file writes with tmp + rename. Sensitive files can opt-in to 0600 permissions on Unix.
Functionsยง
- atomic_
write_ json - Atomically write a serializable value to
pathusing tmp + rename. Creates parent directories if needed. - atomic_
write_ json_ with_ perms - Atomically write a serializable value to
pathusing tmp + rename. Ifrestrict_permsis true, sets file permissions to 0o600 on Unix. - read_
json - Read and deserialize JSON from
path. ReturnsOk(None)if the file does not exist. - remove_
file_ if_ exists - Remove a file if it exists. No error if not found.
- tmp_
path_ for - Helper: build a tmp path for a given file path.