atomicfile

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package atomicfile writes whole files atomically: the payload goes into a temp file next to the target and is then moved over it, so an interrupted write can never leave a half-serialized store or config behind.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Replace

func Replace(source, target string) error

Replace moves source over target in one step.

func WriteFile

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

WriteFile writes data to path atomically, creating parent directories.

func WriteFunc

func WriteFunc(path string, perm os.FileMode, write func(tmp *os.File) error) error

WriteFunc lets a caller serialize into the temp file (for writers that only accept a path or a file), then moves it over path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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