Documentation
¶
Overview ¶
Package atomicfile writes files atomically via temp file + rename.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteFile ¶
WriteFile writes data to path using a temporary file in the same directory then renaming into place. Parent directories are created as needed. mode is applied to the final file (default 0o644 if zero).
Prefer WriteFileRoot for paths under a sync tree; this helper is for absolute paths outside an os.Root (for example the index under StateDir).
func WriteFileRoot ¶
WriteFileRoot writes data to a path relative to root using a temporary file in the same directory then renaming into place. Parent directories are created under root as needed. mode is applied to the final file (default 0o644 if zero).
name must be relative to root (slash-separated is preferred). All I/O goes through root so path components and symlinks cannot escape the root tree. name is validated with fs.ValidPath and filepath.IsLocal before any I/O.
Types ¶
This section is empty.