Documentation
¶
Index ¶
- func Append(data string, dst string) (err error)
- func CommandExists(name string) (bool, error)
- func Copy(src, dst string) (err error)
- func CopyDir(src, dst string, newDirPermissions, childFilePermissions fs.FileMode, ...) (err error)
- func CopyResourceFile(srcFS fs.FS, srcFile, dst string, dirmode os.FileMode, filemode os.FileMode) error
- func Create(dst string, perm os.FileMode) (err error)
- func CreateDestinationDir(dst string, dirmode os.FileMode) (err error)
- func DirExists(path string) (exists bool, err error)
- func EnumerateDirFiles(dirPath string) (filePaths []string, err error)
- func GenerateSHA1(path string) (hash string, err error)
- func GenerateSHA256(path string) (hash string, err error)
- func GetAbsPathWithBase(baseDirPath, inputPath string) string
- func IsDir(filePath string) (isDir bool, err error)
- func IsDirEmpty(path string) (bool, error)
- func IsFile(path string) (isFile bool, err error)
- func IsFileOrSymlink(path string) (isFile bool, err error)
- func Move(src, dst string) (err error)
- func PathExists(path string) (exists bool, err error)
- func Read(src string) (data string, err error)
- func ReadLines(path string) (lines []string, err error)
- func RemoveDirectoryContents(path string) (err error)
- func RemoveFileIfExists(path string) (err error)
- func Write(data string, dst string) (err error)
- func WriteLines(dataLines []string, destinationPath string) (err error)
- func WriteWithPerm(data string, dst string, perm os.FileMode) (err error)
- type FileCopyBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandExists ¶
func Copy ¶
Copy copies a file from src to dst, creating directories for the destination if needed. dst is assumed to be a file and not a directory. Will preserve permissions.
func CopyDir ¶
func CopyDir(src, dst string, newDirPermissions, childFilePermissions fs.FileMode, mergedDirPermissions *fs.FileMode) (err error)
CopyDir copies src directory to dst, creating the dst directory if needed. dst is assumed to be a directory and not a file.
func CopyResourceFile ¶
func CopyResourceFile(srcFS fs.FS, srcFile, dst string, dirmode os.FileMode, filemode os.FileMode) error
CopyResourceFile copies a file from an embedded binary resource file to disk. This will override any existing file.
func EnumerateDirFiles ¶
func GenerateSHA1 ¶
GenerateSHA1 calculates a sha1 of a file
func GenerateSHA256 ¶
GenerateSHA256 calculates a sha256 of a file
func GetAbsPathWithBase ¶
GetAbsPathWithBase converts 'inputPath' to an absolute path starting from 'baseDirPath', but only if it wasn't an absolute path in the first place.
func IsDirEmpty ¶
func IsFileOrSymlink ¶
IsFileOrSymlink returns true if the provided path is a file or a symlink.
func PathExists ¶
PathExists returns true if the path exists, false otherwise.
func ReadLines ¶
readLines reads file under path and returns lines as strings and any error encountered
func RemoveDirectoryContents ¶
RemoveDirectoryContents will delete the contents of a directory, but not the directory itself. If the directory does not exist, it will return an error.
func RemoveFileIfExists ¶
RemoveFileIfExists will delete a file if it exists on disk.
func WriteLines ¶
WriteLines writes each string to the same file, separated by lineSeparator (e.g. "\n").
Types ¶
type FileCopyBuilder ¶
type FileCopyBuilder struct {
Src string
Dst string
DirFileMode os.FileMode
ChangeFileMode bool
FileMode os.FileMode
NoDereference bool
}
func NewFileCopyBuilder ¶
func NewFileCopyBuilder(src string, dst string) FileCopyBuilder
func (FileCopyBuilder) Run ¶
func (b FileCopyBuilder) Run() (err error)
func (FileCopyBuilder) SetDirFileMode ¶
func (b FileCopyBuilder) SetDirFileMode(dirFileMode os.FileMode) FileCopyBuilder
func (FileCopyBuilder) SetFileMode ¶
func (b FileCopyBuilder) SetFileMode(fileMode os.FileMode) FileCopyBuilder
func (FileCopyBuilder) SetNoDereference ¶
func (b FileCopyBuilder) SetNoDereference() FileCopyBuilder