atomicfile

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package atomicfile writes files that are never observed half-written.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(path string, data []byte) error

Write replaces path with data atomically: into a sibling temp file first, then renamed into place. rename(2) is atomic on POSIX, so a crash or a concurrent reader sees either the old file or the new one, never a truncated half of the new one. The file is created 0600 — every caller here holds per-user state, and the temp file inherits os.CreateTemp's mode without a separate chmod step.

Types

This section is empty.

Jump to

Keyboard shortcuts

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