fsutil

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package fsutil provides small filesystem helpers shared across glasp's internal packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFileAtomic

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

WriteFileAtomic writes data to path by writing to a temporary file in the same directory and renaming it into place, so a concurrent reader (or a process killed mid-write) never observes a partially written file. perm is applied to the temporary file before the rename so the final file has the requested permissions from the moment it becomes visible at path.

The destination is replaced by a single rename, so it is never observed missing: a concurrent reader sees either the old content or the new one. The rename does not follow a symlink at path onto another location — if path is a symlink, the rename replaces the symlink itself, not the file it points at (os.Rename never follows symlinks).

Types

This section is empty.

Jump to

Keyboard shortcuts

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