Documentation
¶
Index ¶
- func AppendFile(filename string, data string)
- func AppendLine(path string, content string) error
- func AppendTo(fileName, content string) error
- func BuildDir(absDir string) error
- func CheckFileIsExist(filename string) bool
- func CheckNotExist(src string) bool
- func CheckPermission(src string) bool
- func Copy(src, dst string) error
- func CopyDir(source string, dest string) (err error)
- func CopyFile(source string, dest string) (err error)
- func DeleteFile(absDir string) error
- func DirName(argv ...string) string
- func Empty(fileName string, args ...int64)
- func Exist(fileName string) bool
- func FileExt(filePathName string) string
- func GetCurrentDirectory() string
- func GetExt(fileName string) string
- func GetFileSize(path string) (i int64, err error)
- func GetImageName(name string) string
- func GetModelPath() string
- func GetPathDirs(absDir string) (re []string)
- func GetPathFiles(absDir string) (re []string)
- func GetProPath() string
- func GetSize(r io.Reader) (i int, err error)
- func GrepFile(patten string, filename string) (lines []string, err error)
- func IoSha(fileIO *os.File, args ...string) (string, error)
- func Is(filePath string) bool
- func IsBinary(content string) bool
- func IsDir(path string) bool
- func IsExist(path string) bool
- func IsFile(f string) bool
- func IsImg(extension string) bool
- func IsNotExistMkDir(src string) (err error)
- func List(dirPth, suffix string) (files []string, err error)
- func ListDir(dirPth, suffix string) (files []string, err error)
- func MTime(file string) (int64, error)
- func MkDir(src string) (err error)
- func Mode(filePath string) os.FileMode
- func MustOpen(fileName, filePath string) (f *os.File, err error)
- func Open(name string, flag int, perm os.FileMode) (f *os.File, err error)
- func OpenCopy(srcName, dstName string) (int64, error)
- func PathExists(path string) (bool, error)
- func ReadFile(path string) (string, error)
- func ReadLine(path string) (src []string)
- func Search(fileName string, paths ...string) (fullpath string, err error)
- func Sha(filePath string, args ...string) (sha string, err error)
- func Size(file string) (int64, error)
- func TempFile(dir, prefix string, suffix string) (f *os.File, err error)
- func Walk(dirPth, suffix string) (files []string, err error)
- func WalkDir(dirPth, suffix string) (files []string, err error)
- func Write(fileName, writeStr string)
- func WriteFile(fileName string, data []byte) error
- func WriteString(path string, content string, append bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶ added in v0.2.25
func AppendLine ¶ added in v0.2.32
func CheckFileIsExist ¶ added in v0.2.19
CheckFileIsExist 检查目录是否存在
func CheckPermission ¶
CheckPermission check if the file has permission
func Exist ¶ added in v0.2.39
Exist checks whether a file or directory exists. It returns false when the file or directory does not exist.
func GetCurrentDirectory ¶ added in v0.2.19
func GetCurrentDirectory() string
GetCurrentDirectory 获取程序运行路径
func GetFileSize ¶
GetFileSize get the length in bytes of file of the specified path.
func GetPathDirs ¶ added in v0.2.19
GetPathDirs 获取目录所有文件夹
func GetPathFiles ¶ added in v0.2.19
GetPathFiles 获取目录所有文件
func GetProPath ¶ added in v0.2.25
func GetProPath() string
func GrepFile ¶
GrepFile like command grep -E for example: GrepFile(`^hello`, "hello.txt") \n is striped while read
func Is ¶ added in v0.2.39
Is returns true if path is a file, or returns false when it's a directory or not exist.
func IsNotExistMkDir ¶
IsNotExistMkDir create a directory if it does not exist
func PathExists ¶ added in v0.2.32
PathExists path is exist
func TempFile ¶ added in v0.2.37
TempFile creates a new temporary file in the directory dir with a name beginning with prefix and ending with suffix, opens the file for reading and writing, and returns the resulting *os.File. If dir is the empty string, TempFile uses the default directory for temporary files (see os.TempDir). Multiple programs calling TempFile simultaneously will not choose the same file. The caller can use f.Name() to find the pathname of the file. It is the caller's responsibility to remove the file when no longer needed.
func Write ¶ added in v0.2.39
func Write(fileName, writeStr string)
Write writes data to a file named by filename. If the file does not exist, WriteFile creates it and its upper level paths.
Types ¶
This section is empty.