atomicfile

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFile

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

WriteFile writes data to path atomically (best-effort cross-platform).

It writes to a temporary file in the same directory and renames it into place. This avoids torn writes if the process crashes mid-write.

perm is used for the temp file. If perm is 0, WriteFile will try to preserve the existing file's mode (if it exists) and otherwise falls back to 0644.

Types

This section is empty.

Jump to

Keyboard shortcuts

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