Documentation
¶
Overview ¶
package atomic provides functions to atomically change files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
type FileOptions ¶
type FileOptions struct {
// contains filtered or unexported fields
}
FileOptions define the behaviour of `FileWrite()`.
type Option ¶
type Option func(*FileOptions)
Option functions modify FileOptions.
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 ¶
KeepFileMode preserves the file mode of an existing file instead of using the default value.