fs

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(path string, perm os.FileMode) (*os.File, error)

Create creates a new file with O_EXCL flag to ensure atomic creation. Returns error if the file already exists.

func CreateWithBackup

func CreateWithBackup(path string) (*os.File, func(), func() error, error)

CreateWithBackup creates a new file while preserving the old one as a backup. The backup will have the same name as the original with ".backup" appended. Returns: - temporary file for writing - cleanup function to remove temporary file - commit function to save changes and create backup - error if any

func DirSize

func DirSize(path string) (int64, error)

func IsUnsafePath added in v1.6.0

func IsUnsafePath(path string) (bool, error)

IsUnsafePath checks if the given path is unsafe to remove

func Move

func Move(src, dst string, fallbackCopy bool) error

Move moves a file or directory from src to dst. If the move fails due to being on different devices and fallbackCopy is true, it will fall back to copy and delete.

Types

This section is empty.

Jump to

Keyboard shortcuts

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