Documentation
¶
Overview ¶
Package file writes files atomically, so readers see either the old contents or the new, never a partial write.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Write ¶
Write atomically replaces the file at path with data, leaving it with exactly perm whatever the umask and whatever mode an existing file had. It behaves like WriteFunc.
func WriteFunc ¶
WriteFunc atomically replaces the file at path with whatever write writes, leaving it with exactly perm whatever the umask and whatever mode an existing file had.
The content goes to a temporary file in the same directory, which is synced and renamed over path, and then the directory is synced so the rename survives a crash (except on Windows, where directories can't be synced). If write or any step before the rename fails, the temporary file is removed and path is left untouched. If only the directory sync fails, path has already been replaced and the error is still returned.
Types ¶
This section is empty.