Documentation
¶
Overview ¶
package atomic provides functions to change files atomically.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultFileMode ¶
DefaultFileMode sets the default file mode instead of using the `ioutil.TempFile()` default of `0600`.
func FileMode ¶
FileMode sets the file mode to the desired value and has precedence over all other options.
func KeepFileMode ¶
func KeepFileMode(keep bool) option
KeepFileMode preserves the file mode of an existing file instead of using the default value.
func ReplaceFile ¶
ReplaceFile atomically replaces the destination file or directory with the source. It is guaranteed to either replace the target file entirely, or not change either file.
func WriteFile ¶
WriteFile atomically writes the contents of r to the specified filepath. If an error occurs, the target file is guaranteed to be either fully written, or not written at all. WriteFile overwrites any file that exists at the location (but only if the write fully succeeds, otherwise the existing file is unmodified). Additional option arguments can be used to change the default configuration for the target file.
Types ¶
This section is empty.