Documentation ¶
Index ¶
- Variables
- func AppendFile(srcPath string, destFile *os.File) error
- func CleanOldDirs() error
- func CopyDir(fromPath, toPath string, includeDirs bool, excludeNames []string) error
- func CopyFile(dst, src string) error
- func CreateDirIfNotExist(path string) error
- func CreateFilePath(localPath, fileName string) (string, error)
- func CreateTempDir() (string, error)
- func CreateTempFile() (*os.File, error)
- func FilesIdentical(file1 string, file2 string) (bool, error)
- func FindUpstream(itemToFInd string, itemType ItemType) (wd string, exists bool, err error)
- func GetFileAndDirFromPath(path string) (fileName, dir string)
- func GetFileInfo(path string, preserveSymLink bool) (fileInfo os.FileInfo, err error)
- func GetFileSeparator() string
- func GetFileSize(file *os.File) (int64, error)
- func GetHomeDir() string
- func GetLocalPathAndFile(originalFileName, relativePath, targetPath string, flat bool) (localTargetPath, fileName string)
- func GetUploadRequestContent(file *os.File) io.Reader
- func IsDirExists(path string, preserveSymLink bool) (bool, error)
- func IsFileExists(path string, preserveSymLink bool) (bool, error)
- func IsFileSymlink(file os.FileInfo) bool
- func IsPathExists(path string, preserveSymLink bool) bool
- func IsPathSymlink(path string) bool
- func IsSshUrl(urlPath string) bool
- func IsStringInSlice(string string, strings []string) bool
- func IsZip(filename string) bool
- func ListFiles(path string, includeDirs bool) ([]string, error)
- func ListFilesRecursiveWalkIntoDirSymlink(path string, walkIntoDirSymlink bool) (fileList []string, err error)
- func ListFilesWithExtension(path, ext string) ([]string, error)
- func ReadFile(filePath string) ([]byte, error)
- func RemovePath(testPath string) error
- func RemoveTempDir(dirPath string) error
- func RenamePath(oldPath, newPath string) error
- func SetTempDirBase(dirPath string)
- func Unzip(at io.ReaderAt, size int64, dest string) error
- func Walk(root string, walkFn WalkFunc, walkIntoDirSymlink bool) error
- func ZipFolderFiles(source, target string) (err error)
- type ChecksumDetails
- type FileDetails
- type ItemType
- type Stat
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var SkipDir = errors.New("skip this directory")
Functions ¶
func AppendFile ¶
Reads the content of the file in the source path and appends it to the file in the destination path.
func CleanOldDirs ¶ added in v0.13.0
func CleanOldDirs() error
Old runs/tests may leave junk at temp dir. Each temp file/Dir is named with prefix+timestamp, search for all temp files/dirs that match the common prefix and validate their timestamp.
func CopyDir ¶
Copy directory content from one path to another. includeDirs means to copy also the dirs if presented in the src folder. excludeNames - Skip files/dirs in the src folder that match names in provided slice. ONLY excludes first layer (only in src folder).
func CreateDirIfNotExist ¶
func CreateFilePath ¶
func CreateTempDir ¶ added in v0.3.3
Creates the temp dir at tempDirBase. Set tempDirPath to the created directory path.
func CreateTempFile ¶ added in v0.13.0
Create a new temp file named "tempPrefix+timeStamp".
func FilesIdentical ¶ added in v0.13.0
Returns true if the two files have the same MD5 checksum.
func FindUpstream ¶ added in v0.3.2
Returns the path to the directory in which itemToFind is located. Traversing through directories from current work-dir to root. itemType determines whether looking for a file or dir.
func GetFileAndDirFromPath ¶
func GetFileInfo ¶
Get the file info of the file in path. If path points at a symlink and `preserveSymLink == true`, return the file info of the symlink instead
func GetFileSeparator ¶
func GetFileSeparator() string
func GetHomeDir ¶
func GetHomeDir() string
func GetLocalPathAndFile ¶
func GetLocalPathAndFile(originalFileName, relativePath, targetPath string, flat bool) (localTargetPath, fileName string)
Get the local path and filename from original file name and path according to targetPath
func IsDirExists ¶
Check if path points at a directory. If path points at a symlink and `preserveSymLink == true`, function will return `false` regardless of the symlink target
func IsFileExists ¶
Check if path points at a file. If path points at a symlink and `preserveSymLink == true`, function will return `true` regardless of the symlink target
func IsFileSymlink ¶
func IsPathExists ¶
Check if path exists. If path points at a symlink and `preserveSymLink == true`, function will return `true` regardless of the symlink target
func IsPathSymlink ¶
func IsStringInSlice ¶ added in v0.12.0
func ListFilesRecursiveWalkIntoDirSymlink ¶
func ListFilesRecursiveWalkIntoDirSymlink(path string, walkIntoDirSymlink bool) (fileList []string, err error)
Return the recursive list of files and directories in the specified path
func ListFilesWithExtension ¶ added in v0.3.3
Return all files with the specified extension in the specified path. Not recursive.
func RemovePath ¶ added in v0.6.2
Removing the provided path from the filesystem
func RemoveTempDir ¶
func RenamePath ¶ added in v0.6.2
Renaming from old path to new path.
func SetTempDirBase ¶ added in v0.3.3
func SetTempDirBase(dirPath string)
Change the containing directory of temp dir.
func Walk ¶
The same as filepath.Walk the only difference is that we can walk into symlink. Avoiding infinite loops by saving the real paths we already visited.
func ZipFolderFiles ¶
Types ¶
type ChecksumDetails ¶
type FileDetails ¶
type FileDetails struct { Checksum ChecksumDetails Size int64 }
func GetFileDetails ¶
func GetFileDetails(filePath string) (*FileDetails, error)