Documentation ¶
Index ¶
- 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) (err 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 IsDirEmpty(path string) (isEmpty bool, err error)
- func IsDirExists(path string, preserveSymLink bool) (bool, error)
- func IsEqualToLocalFile(localFilePath, md5, sha1 string) (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 IsSupportedArchive(filePath string) bool
- func JsonEqual(filePath1, filePath2 string) (isEqual bool, err error)
- func ListFiles(path string, includeDirs bool) ([]string, error)
- func ListFilesByFilterFunc(path string, filterFunc func(filePath string) (bool, error)) ([]string, error)
- func ListFilesRecursiveWalkIntoDirSymlink(path string, walkIntoDirSymlink bool) (fileList []string, err error)
- func MoveDir(fromPath, toPath string) error
- func MoveFile(sourcePath, destPath string) (err error)
- func ReadFile(filePath string) ([]byte, error)
- func RemoveDirContents(dirPath string) (err error)
- func RemovePath(testPath string) error
- func RemoveTempDir(dirPath string) error
- func RenamePath(oldPath, newPath string) error
- func SetTempDirBase(dirPath string)
- func Unarchive(localArchivePath, originArchiveName, destinationPath string) error
- func ZipFolderFiles(source, target string) (err error)
- type FileDetails
- type ItemType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 ¶
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 ¶
Creates the temp dir at tempDirBase. Set tempDirPath to the created directory path.
func CreateTempFile ¶
Create a new temp file named "tempPrefix+timeStamp".
func FilesIdentical ¶
Returns true if the two files have the same MD5 checksum.
func FindUpstream ¶
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 ¶
Return the file's name and dir of a given path by finding the index of the last separator in the path. Support separators : "/" , "\\" and "\\\\"
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, placeholdersUsed bool) (localTargetPath, fileName string)
Get the local path and filename from original file name and path according to targetPath
func IsDirEmpty ¶
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 IsEqualToLocalFile ¶
Compares provided Md5 and Sha1 to those of a local file.
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 IsSupportedArchive ¶
func ListFilesByFilterFunc ¶
func ListFilesByFilterFunc(path string, filterFunc func(filePath string) (bool, error)) ([]string, error)
Return all files in the specified path who satisfy the filter func. Not recursive.
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 MoveFile ¶
GoLang: os.Rename() give error "invalid cross-device link" for Docker container with Volumes. MoveFile(source, destination) will work moving file between folders Therefore, we are using our own implementation (MoveFile) in order to rename files.
func RemoveDirContents ¶
RemoveDirContents removes the contents of the directory, without removing the directory itself. If it encounters an error before removing all the files, it stops and returns that error.
func RemovePath ¶
Removing the provided path from the filesystem
func RemoveTempDir ¶
func RenamePath ¶
Renaming from old path to new path.
func SetTempDirBase ¶
func SetTempDirBase(dirPath string)
Change the containing directory of temp dir.
func Unarchive ¶
The 'archiver' dependency includes an API called 'Unarchive' to extract archive files. This API uses the archive file extension to determine the archive type. We therefore need to use the file name as it was in Artifactory, and not the file name which was downloaded. To achieve this, we added a new implementation of the 'Unarchive' func and use it instead of the default one. localArchivePath - The local file path to extract the archive originArchiveName - The archive file name destinationPath - The extraction destination directory
func ZipFolderFiles ¶
Types ¶
type FileDetails ¶
func GetFileDetails ¶
func GetFileDetails(filePath string, includeChecksums bool) (details *FileDetails, err error)
func GetFileDetailsFromReader ¶
func GetFileDetailsFromReader(reader io.Reader, includeChecksums bool) (*FileDetails, error)