fileUtils

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNewFileFromFilename

func CreateNewFileFromFilename(fileName string) (*os.File, error)

CreateNewFileFromFilename given a file name, this creates a new file on-disk for writing logs.

func CreateUniqueFileName

func CreateUniqueFileName(
	targetDir, identifier, fileExtension string,
	attempt int,
) string

CreateUniqueFileName creates a new unused filename at the target directory. targetDir: the directory to create the file in. identifier: the base name of the file. fileExtension: the file extension suffix. attempt: the current attempt number, to prevent infinite loops.

func DirExistsOrCreate

func DirExistsOrCreate(dir string) error

DirExistsOrCreate checks if a directory exists, and creates it if it doesn't

func FileExists

func FileExists(fileName string) bool

FileExists returns true if the file exists

func RelocateExistingFileIfExists

func RelocateExistingFileIfExists(fileName string) error

RelocateExistingFileIfExists checks if a file exists, and if it does, renames it to a unique name

Types

This section is empty.

Jump to

Keyboard shortcuts

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