atomicfile

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package atomicfile provides small helpers for crash-safe file replacement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(path string, b []byte, perm, dirPerm os.FileMode) error

Write replaces path with b by writing a sibling temp file and renaming it into place. Parent directories are created with dirPerm and the replacement file is written with perm.

func WritePreserveMode

func WritePreserveMode(path string, b []byte, defaultPerm, dirPerm os.FileMode) error

WritePreserveMode replaces path like Write, preserving the existing file's permission bits when it exists and falling back to defaultPerm otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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