fileutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtomicWrite

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

AtomicWrite writes data to path atomically using a temp file in the same directory followed by a rename. This ensures that a crash mid-write leaves the existing file intact. If the target file already exists, its permissions are preserved; otherwise 0644 is used.

func AtomicWriteWithPerm

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

AtomicWriteWithPerm writes data to path atomically using a temp file in the same directory followed by a rename. The perm parameter is the fallback permission used when the target file does not yet exist. If the target file already exists, its current permissions are preserved (H-19).

Types

This section is empty.

Jump to

Keyboard shortcuts

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