fileutil

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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