fsutil

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fsutil publishes files so that a reader, including one after a crash or power loss, sees either the previous file or the complete new one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncDir

func SyncDir(directory string) error

SyncDir flushes a directory's entries, so a rename into it survives a crash. A filesystem that cannot sync a directory (EINVAL or ENOTSUP, as some network and FUSE mounts answer) offers nothing stronger, so that is not an error.

func SyncFile

func SyncFile(path string) error

SyncFile flushes an already written file to disk, for a caller that publishes it with its own rename.

func WriteFile

func WriteFile(path string, data []byte, mode fs.FileMode) error

WriteFile publishes data at path with the given mode through a temporary file in the same directory. The contents reach the disk before the rename, and the rename reaches it before WriteFile returns.

Types

This section is empty.

Jump to

Keyboard shortcuts

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