fsutil

package
v0.2.9-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFileAtomic

func CopyFileAtomic(src, dst string) error

CopyFileAtomic performs an atomic streaming copy from src to dst. It writes to a temporary file first, then renames it to the destination. This ensures the destination file is never in a partially written state.

Features:

  • Streaming copy (memory-safe for large files)
  • Atomic rename (most filesystems)
  • Automatic cleanup of temp files on error
  • Preserves source file permissions
  • Unique temp filenames (safe for concurrent writes to same destination)

Returns an error if any operation fails (open, copy, close, rename).

func MoveFile

func MoveFile(src, dst string) error

func MoveFileFs

func MoveFileFs(fs afero.Fs, src, dst string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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