fileutils

package
v0.0.0-...-152d858 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const SYMLINK_FILE_CONTENT = ""

Variables

View Source
var SkipDir = errors.New("skip this directory")

Functions

func AppendFile

func AppendFile(srcPath string, destFile *os.File) error

Reads the content of the file in the source path and appends it to the file in the destination path.

func CopyDir

func CopyDir(fromPath, toPath string, includeDirs bool) error

Copy directory content from one path to another. includeDirs means to copy also the dirs if presented in the src folder.

func CopyFile

func CopyFile(dst, src string) error

func CreateDirIfNotExist

func CreateDirIfNotExist(path string) error

func CreateFilePath

func CreateFilePath(localPath, fileName string) (string, error)

func CreateTempDirPath

func CreateTempDirPath() error

func GetFileAndDirFromPath

func GetFileAndDirFromPath(path string) (fileName, dir string)

func GetFileSeparator

func GetFileSeparator() string

func GetFileSize

func GetFileSize(file *os.File) (int64, error)

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 GetTempDirPath

func GetTempDirPath() (string, error)

func GetUploadRequestContent

func GetUploadRequestContent(file *os.File) io.Reader

func IsDir

func IsDir(path string) (bool, error)

func IsDirExists

func IsDirExists(path string) (bool, error)

func IsFileExists

func IsFileExists(path string) (bool, error)
func IsFileSymlink(file os.FileInfo) bool

func IsPathExists

func IsPathExists(path string) bool
func IsPathSymlink(path string) bool

func IsSshUrl

func IsSshUrl(urlPath string) bool

func IsZip

func IsZip(filename string) bool

func ListFiles

func ListFiles(path string, includeDirs bool) ([]string, error)

Return the list of files and directories in the specified path

func ListFilesRecursiveWalkIntoDirSymlink(path string, walkIntoDirSymlink bool) (fileList []string, err error)

Return the recursive list of files and directories in the specified path

func ReadFile

func ReadFile(filePath string) ([]byte, error)

func RemoveTempDir

func RemoveTempDir() error

func Unzip

func Unzip(at io.ReaderAt, size int64, dest string) error

func Walk

func Walk(root string, walkFn WalkFunc, walkIntoDirSymlink bool) error

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

func ZipFolderFiles(source, target string) (err error)

Types

type ChecksumDetails

type ChecksumDetails struct {
	Md5    string
	Sha1   string
	Sha256 string
}

type FileDetails

type FileDetails struct {
	Checksum ChecksumDetails
	Size     int64
}

func GetFileDetails

func GetFileDetails(filePath string) (*FileDetails, error)

type Stat

type Stat func(path string) (info os.FileInfo, err error)

type WalkFunc

type WalkFunc func(path string, info os.FileInfo, err error) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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