fileutil

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDirShallow

func CopyDirShallow(src string, dest string) error

func CopyFile

func CopyFile(src string, dest string) error

func FindFilesWithExtension

func FindFilesWithExtension(dir string, ext ...string) []string

func GenerateFilePathAdjacentToFile

func GenerateFilePathAdjacentToFile(sourceFilePath string, suffix string, forceOverwrite bool) string

GenerateFilePathAdjacentToFile creates a filename based on the sourceFilePath, first by removing the extension and then adding the given suffix. The full path is returned.

func GenerateTempFilePattern

func GenerateTempFilePattern(localPath string) string

GenerateTempFilePattern creates a temporary file pattern based on the provided localPath. It prefixes the extension with a star (*) to ensure uniqueness, as per the os.CreateTemp documentation.

func ListFiles

func ListFiles(dir string, includeHidden bool) ([]string, error)

func MoveFile

func MoveFile(src, dest string) error

MoveFile moves a file from src to dest, falling back to copy+delete if os.Rename fails (e.g. across filesystem boundaries).

func MustNotExist

func MustNotExist(destFilePath string, forceOverwrite bool)

func ReadFile

func ReadFile(filePath string) (*[]byte, error)

ReadFile reads the contents of a file and returns it as a byte slice.

func WatchDir

func WatchDir(dir string) (updatedC chan bool)

WatchDir observes changes to the given directory and notifies on a channel when they occur.

Types

This section is empty.

Jump to

Keyboard shortcuts

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