atomic

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MoveFile

func MoveFile(src, dst string) error

MoveFile copies file from src to dst. It only works with a single file and fails, if dst already exists or if dirname(dst) does not exist. Works across partitions (to mitigate "errno 18" "Invalid cross-device link" kind of errors on rename).

func WriteFile

func WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFileAtomic writes the data to a temp file and atomically move if everything else succeeds.

func WriteFileReader

func WriteFileReader(filename string, r io.Reader, perm os.FileMode) error

WriteFileReader writes data from a reader atomically into filename. Beware that this will read all file content into memory first.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL