Documentation
¶
Index ¶
- func ClearFile(path string) error
- func CopyFile(srcPath string, dstPath string) error
- func CreateDir(absPath string) error
- func CreateFile(path string) bool
- func CurrentPath() string
- func FileMode(path string) (fs.FileMode, error)
- func FileSize(path string) (int64, error)
- func IsDir(path string) bool
- func IsExist(path string) bool
- func IsLink(path string) bool
- func IsZipFile(filepath string) bool
- func ListFileNames(path string) ([]string, error)
- func MTime(filepath string) (int64, error)
- func MiMeType(file any) string
- func ReadCsvFile(filepath string) ([][]string, error)
- func ReadFileByLine(path string) ([]string, error)
- func ReadFileToString(path string) (string, error)
- func RemoveFile(path string) error
- func Sha(filepath string, shaType ...int) (string, error)
- func UnZip(zipFile string, destPath string) error
- func WriteBytesToFile(filepath string, content []byte) error
- func WriteStringToFile(filepath string, content string, append bool) error
- func Zip(fpath string, destPath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearFile ¶
ClearFile write empty string to path file. Play: https://go.dev/play/p/NRZ0ZT-G94H
func CopyFile ¶
CopyFile copy src file to dest file. Play: https://go.dev/play/p/Jg9AMJMLrJi
func CreateDir ¶
CreateDir create directory in absolute path. param `absPath` like /a/, /a/b/. Play: https://go.dev/play/p/qUuCe1OGQnM
func CreateFile ¶
CreateFile create a file in path. Play: https://go.dev/play/p/lDt8PEsTNKI
func CurrentPath ¶
func CurrentPath() string
CurrentPath return current absolute path. Play: https://go.dev/play/p/s74a9iBGcSw
func FileMode ¶
FileMode return file's mode and permission. Play: https://go.dev/play/p/2l2hI42fA3p
func FileSize ¶
FileSize returns file size in bytes. Play: https://go.dev/play/p/H9Z05uD-Jjc
func IsDir ¶
IsDir checks if the path is directory or not. Play: https://go.dev/play/p/WkVwEKqtOWk
func IsExist ¶
IsExist checks if a file or directory exists. Play: https://go.dev/play/p/nKKXt8ZQbmh
func IsLink ¶
IsLink checks if a file is symbol link or not. Play: https://go.dev/play/p/TL-b-Kzvf44
func IsZipFile ¶
IsZipFile checks if file is zip or not. Play: https://go.dev/play/p/9M0g2j_uF_e
func ListFileNames ¶
ListFileNames return all file names in the path. Play: https://go.dev/play/p/Tjd7Y07rejl
func MTime ¶
MTime returns file modified time. Play: https://go.dev/play/p/s_Tl7lZoAaY
func MiMeType ¶
MiMeType return file mime type param `file` should be string(file path) or *os.File. Play: https://go.dev/play/p/bd5sevSUZNu
func ReadCsvFile ¶
ReadCsvFile read file content into slice. Play: https://go.dev/play/p/OExTkhGEd3_u
func ReadFileByLine ¶
ReadFileByLine read file line by line. Play: https://go.dev/play/p/svJP_7ZrBrD
func ReadFileToString ¶
ReadFileToString return string of file content. Play: https://go.dev/play/p/cmfwp_5SQTp
func RemoveFile ¶
RemoveFile remove the path file. Play: https://go.dev/play/p/P2y0XW8a1SH
func Sha ¶
Sha returns file sha value, param `shaType` should be 1, 256 or 512. Play: https://go.dev/play/p/VfEEcO2MJYf
func UnZip ¶
UnZip unzip the file and save it to destPath. Play: https://go.dev/play/p/g0w34kS7B8m
func WriteBytesToFile ¶
WriteBytesToFile write bytes to target file. Play: https://go.dev/play/p/s7QlDxMj3P8
func WriteStringToFile ¶
WriteStringToFile write string to target file. Play: https://go.dev/play/p/GhLS6d8lH_g
Types ¶
This section is empty.