Documentation
¶
Overview ¶
Package atomicfile implements all-or-nothing file replacement by staging output to a temporary file adjacent to the target, and renaming over the target when the temporary is closed.
If (and only if) the implementation of rename is atomic the replacement is also atomic. Since IEEE Std 1003.1 requires rename to be atomic, this is ordinarily true on POSIX-compatible filesystems.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
A File is a writable temporary file that will be renamed to a target path when successfully closed.
func New ¶
New constructs a new writable File with the given mode that, when successfully closed will be renamed to target.
func (*File) Cancel ¶
func (f *File) Cancel()
Cancel closes the temporary associated with f and discards it. It is safe to call Cancel even if f.Close has already succeeded.