Documentation
¶
Index ¶
- Constants
- func Copy(src, dest string) error
- func CopyDir(srcPath, destPath string, filters ...func(filePath string) bool) error
- func CopyDir1(srcPath string, destPath string) error
- func CopyFile(src, dest string) (w int64, err error)
- func FileMTime(file string) (int64, error)
- func FileSize(file string) (int64, error)
- func GetAllSubDirs(rootPath string) ([]string, error)
- func GetFileExist(filepath string) bool
- func GetFileListBySuffix(dirPath, suffix string) ([]string, error)
- func GetGOPATHs() []string
- func GetMP4Duration(reader io.ReaderAt) (lengthOfTime uint32, err error)
- func GetSrcPath(importPath string) (appPath string, err error)
- func HomeDir() (home string, err error)
- func HumaneFileSize(s uint64) string
- func IsDir(fileAddr string) bool
- func IsDirOrCreate(fileAddr string) bool
- func IsExist(path string) bool
- func IsFile(filePath string) bool
- func LgetAllSubDirs(rootPath string) ([]string, error)
- func LstatDir(rootPath string, includeDir ...bool) ([]string, error)
- func StatDir(rootPath string, includeDir ...bool) ([]string, error)
- func WalkDir(dirPth string, suffix []string) (files []string, err error)
- func WriteFile(filename string, data []byte) error
- type BoxHeader
Constants ¶
const ( Byte = 1 KByte = Byte * 1024 MByte = KByte * 1024 GByte = MByte * 1024 TByte = GByte * 1024 PByte = TByte * 1024 EByte = PByte * 1024 )
Storage unit constants.
Variables ¶
This section is empty.
Functions ¶
func CopyDir ¶
CopyDir 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 CopyDir1 ¶
*
- 拷贝文件夹,同时拷贝文件夹中的文件
- @param srcPath 需要拷贝的文件夹路径: D:/test
- @param destPath 拷贝到的位置: D:/backup/
func GetAllSubDirs ¶
GetAllSubDirs returns all subdirectories of given root path. Slice does not include given path itself.
func GetFileExist ¶
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 GetMP4Duration ¶
GetMP4Duration 获取视频时长,以秒计
func GetSrcPath ¶
GetSrcPath returns app. source code path. It only works when you have src. folder in GOPATH, it returns error not able to locate source folder path.
func HomeDir ¶
HomeDir returns path of '~'(in Linux) on Windows, it returns error when the variable does not exist.
func HumaneFileSize ¶
HumaneFileSize calculates the file size and generate user-friendly string.
func IsDirOrCreate ¶
func IsExist ¶
IsExist checks whether a file or directory exists. It returns false when the file or directory does not exist.
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 '/'.