Skip to content

package fs

import "github.com/cloudboss/unobin/pkg/fs"

Package fs holds filesystem helpers shared across packages.

Functions

func WriteFileAtomic

func WriteFileAtomic(path string, content []byte, mode os.FileMode) error

WriteFileAtomic writes content to path via a sibling `.\.tmp` file: write, fsync, rename into place, fsync the parent directory so the rename survives a crash. The parent directory must already exist.