Help us shape the future of Go! Take the 2026 Go Developer Survey

safewrite

package
v1.35.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: 3 Imported by: 0

Documentation

Overview

Package safewrite writes a file by renaming a fully written temporary file over its destination. It imports nothing from this module, so any writer can share it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func File

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

File writes data to path with mode perm, through a temporary file in the same directory renamed into place. The rename replaces the directory entry, so a symlink or hard link already at path is replaced rather than written through, and a pre-existing file's mode does not survive. A reader never sees a partial file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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