fileutil

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureParentDir

func EnsureParentDir(filePath string) error

EnsureParentDir creates parent directories for the given path if they do not exist.

func FlockExclusive

func FlockExclusive(f *os.File, nonBlocking bool) error

FlockExclusive acquires an exclusive (write) lock on the file. If nonBlocking is true, returns immediately with an error if the lock cannot be acquired.

func FlockShared

func FlockShared(f *os.File, nonBlocking bool) error

FlockShared acquires a shared (read) lock on the file. If nonBlocking is true, returns immediately with an error if the lock cannot be acquired.

func Funlock

func Funlock(f *os.File) error

Funlock releases the lock on the file.

func ReplaceFileAtomically

func ReplaceFileAtomically(tempPath, targetPath string) error

ReplaceFileAtomically renames tempPath to targetPath. On systems where cross-device rename fails, it falls back to remove-then-rename.

Types

This section is empty.

Jump to

Keyboard shortcuts

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