file

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanDir

func CleanDir(dirPath string)

CleanDir "cleans" the given directory by deleting and recreating it with "allow everything" rights

func CleanDirFromFiles

func CleanDirFromFiles(dirPath string)

CleanDirFromFiles "cleans" the given directory from files, i.e. deletes all files (but no directories) from it

func CopyDir

func CopyDir(srcDirPath, dstDirPath string) error

CopyDir copies a whole directory recursively

func CopyDirAndRenameFiles

func CopyDirAndRenameFiles(srcDirPath, dstDirPath string, replacements map[string]string) error

func CopyDirAndReplaceContentInFiles

func CopyDirAndReplaceContentInFiles(srcDirPath, dstDirPath string, replacements map[string]string) error

CopyDirAndReplaceContentInFiles copies a whole directory recursively and does replacements in all files' contents as provided in the given map

func CopyFile

func CopyFile(srcPath, dstPath string) error

CopyFile copies a single file from src to dst

func CopyFileAndReplaceContent

func CopyFileAndReplaceContent(srcFilePath, dstFilePath string, replacements map[string]string) error

CopyFileAndReplaceContent copies a single file from src to dst and does replacements in the file's content as provided in the given map

func CreateDir

func CreateDir(dirPath string)

CreateDir creates the given directory with "allow everything" rights

func Exists

func Exists(fileOrDirPath string) bool

Exists checks if a file or dir is existing

func ReadFile

func ReadFile(filePath string) string

ReadFile reads and returns the content of a file and encapsulates error handling

func ReadFileLines

func ReadFileLines(filePath string) []string

ReadFileLines ReadFile reads and returns the content of a file as an arrays of lines and encapsulates error handling

func RemoveDir

func RemoveDir(dirPath string)

RemoveDir removes the given directory - just there for convenience

func RenameFilesInDir

func RenameFilesInDir(dirPath string, replacements map[string]string) error

func ReplaceFileContent

func ReplaceFileContent(filePath string, value string, replacement string)

ReplaceFileContent replaces value in the file's content by replacement

func WriteFile

func WriteFile(dstFilePath string, fileContent string, executable bool)

WriteFile writes a file and encapsulates error check and file rights setting

Types

This section is empty.

Jump to

Keyboard shortcuts

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