Documentation ¶
Index ¶
- func AtomicWriteFile(filepath string, data []byte, perm os.FileMode) (err error)
- func CleanDir(dir string)
- func CleanDirs(dirs ...string)
- func CleanFile(file *os.File)
- func CleanFiles(file ...string) error
- func Copy(src, dest string) error
- func CopyDirV3(srcPath, destPath string, filters ...func(filePath string) bool) error
- func CountDirFiles(dirName string) int
- func Filename(f string) string
- func GetAllSubDirs(rootPath string) ([]string, error)
- func GetFileListBySuffix(dirPath, suffix string) ([]string, error)
- func GetFileSize(path string) (size int64, err error)
- func GetFiles(path string) (paths []string, err error)
- func GetFilesSize(paths []string) (int64, error)
- func GetHomeDir() string
- func IsDir(path string) bool
- func IsExist(fileName string) bool
- func IsFile(filePath string) bool
- func LgetAllSubDirs(rootPath string) ([]string, error)
- func LstatDir(rootPath string, includeDir ...bool) ([]string, error)
- func MkDirs(dirs ...string) error
- func MkTmpFile(path string) (*os.File, error)
- func MkTmpdir(dir string) (string, error)
- func ReadAll(fileName string) ([]byte, error)
- func ReadLines(fileName string) ([]string, error)
- func RecursionCopy(src, dst string) error
- func StatDir(rootPath string, includeDir ...bool) ([]string, error)
- func WriteFile(fileName string, content []byte) error
- func WriteLines(fileName string, lines []string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile ¶
func CopyDirV3 ¶
CopyDirV3 copy files recursively from source to target directory.
The filter accepts a function that process the path info. and should return true for need to filter.
It returns error when error occurs in underlying functions.
func CountDirFiles ¶
CountDirFiles reutrns # of files under a directory.
func GetAllSubDirs ¶
GetAllSubDirs returns all subdirectories of given root path. Slice does not include given path itself.
func GetFileListBySuffix ¶
GetFileListBySuffix returns an ordered list of file paths. It recognize if given path is a file, and don't do recursive find.
func GetFileSize ¶
GetFileSize returns the size of a file.
func GetFilesSize ¶
GetFilesSize returns the size of multiple files.
func GetHomeDir ¶
func GetHomeDir() string
func IsFile ¶
IsFile returns true if given path is a file, or returns false when it's a directory or does not exist.
func LgetAllSubDirs ¶
LgetAllSubDirs returns all subdirectories of given root path, including following symbolic links, if any. Slice does not include given path itself.
func LstatDir ¶
LstatDir gathers information of given directory by depth-first. It returns slice of file list, follows symbolic links and includes subdirectories if enabled; it returns error and nil slice when error occurs in underlying functions, or given path is not a directory or does not exist.
Slice does not include given path itself. If subdirectories is enabled, they will have suffix '/'.
func StatDir ¶
StatDir gathers information of given directory by depth-first. It returns slice of file list and includes subdirectories if enabled; it returns error and nil slice when error occurs in underlying functions, or given path is not a directory or does not exist.
Slice does not include given path itself. If subdirectories is enabled, they will have suffix '/'.
func WriteLines ¶
WriteLines outputs lines to the file.
Types ¶
This section is empty.