Documentation ¶
Index ¶
- func AbsPath(filePath string) (string, error)
- func Append(fileName string, data []byte, perm ...os.FileMode) error
- func Copy(srcName, destName string, perm ...os.FileMode) error
- func Deldir(filePath string) error
- func DirSize(rootPath string) (fileNum, dirSize int64)
- func Ext(fileName string) string
- func Hash(fileName string, h hash.Hash) (string, error)
- func IsAbsPath(filePath string) bool
- func IsDir(filePath string) bool
- func IsExist(filePath string) bool
- func IsFile(filePath string) bool
- func MD5(fileName string) (string, error)
- func Mkdir(filePath string, perm ...os.FileMode) error
- func Read(fileName string) ([]byte, error)
- func ReadToSlice(fileName string) ([]string, error)
- func Remove(fileName string) error
- func Rename(oldName, newName string) error
- func SHA1(fileName string) (string, error)
- func SHA256(fileName string) (string, error)
- func SHA512(fileName string) (string, error)
- func Size(fileName string) int64
- func Write(fileName string, data []byte, perm ...os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append appends data to the end of the file by file name with perm, default perm is 0666. If the file does not exist, Append creates it with permissions perm, otherwise Append appends data to the end of the file.
func Copy ¶
Copy copies src file contents to dest file contents with perm, default perm is 0666. If dest file already exists, Copy truncates it before copying.
func Deldir ¶
Deldir deletes file path and any children it contains. It deletes everything it can but returns the first error it encounters. If the file path does not exist, Deldir does nothing and returns nil.
func DirSize ¶
DirSize returns the number of files contained in the dictionary and size in bytes. If the dictionary is empty or does not exist or cannot be accessed, it returns 0, 0.
func Mkdir ¶
Mkdir creates a directory by file path with perm, along with any necessary parents, default perm is 0777. If the file path is already a directory, Mkdir does nothing and returns nil.
func ReadToSlice ¶
ReadToSlice returns the file contents slice separated by row, and excluding the end-of-line bytes.
func Rename ¶
Rename renames (moves) old name to new name. If new name already exists and is not a directory, Rename replaces it.
Types ¶
This section is empty.