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 CheckAndGetParentDir(path string) string
- func CheckFileIsExist(filename string) bool
- func CheckNotExist(src string) bool
- func CheckPermission(src string) bool
- func CopyDir(source string, dest string) (err error)
- func CopyFile(source string, dest string) (err error)
- func CountLines(file string) (int, error)
- func DeleteFile(absDir string) error
- func DirName(argv ...string) string
- func Empty(fileName string, args ...int64)
- func Exist(fileName string) bool
- func Exists(fpath string) bool
- func FileExt(filePathName string) string
- func FirstLine(filename string) (string, error)
- func GetCurrentDirectory() string
- func GetCurrentPackage() string
- func GetExt(fileName string) string
- func GetFileSize(path string) (i int64, err error)
- func GetImageName(name string) 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 IsDirectory(path string) (bool, error)
- func IsExist(path string) bool
- func IsFile(f string) bool
- func IsFileChanged(src, dest string) (bool, error)
- func IsImg(extension string) bool
- func IsNotExistMkDir(src string) (err error)
- func LastLine(filename string) (string, error)
- func ListFiles(dir string, ext string) []string
- func Lock(name string) (io.Closer, error)
- func MTime(file string) (int64, error)
- func MakeDirectory(dirs ...string) error
- func MkDir(src string) (err error)
- func MkdirIfNecessary(createDir string) 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 ReadFile(path string) (string, error)
- func ReadLine(path string) (src []string)
- func RecursiveDirsLookup(root string, pattern string) ([]string, error)
- func RecursiveFilesLookup(root string, pattern string) ([]string, error)
- func Save(filename string, r io.Reader) (err error)
- 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 TempFileWithText(text string) (*os.File, error)
- func TempFilenameWithText(text string) (string, error)
- func Write(fileName, writeStr string)
- func WriteFile(fileName string, data []byte) error
- func WriteString(path string, content string, append bool) error
- type FileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendFile ¶
func AppendLine ¶
func CheckPermission ¶
CheckPermission check if the file has permission
func CountLines ¶
func Exist ¶
Exist checks whether a file or directory exists. It returns false when the file or directory does not exist.
func GetFileSize ¶
GetFileSize get the length in bytes of file of the specified path.
func GetProPath ¶
func GetProPath() string
func GrepFile ¶
GrepFile like command grep -E for example: GrepFile(`^hello`, "hello.txt") \n is striped while read
func IsFileChanged ¶
IsFileChanged reports whether src and dest config files are equal. Two config files are equal when they have the same file contents and Unix permissions. The owner, group, and mode must match. Returns false in other cases.
func IsNotExistMkDir ¶
IsNotExistMkDir create a directory if it does not exist
func RecursiveDirsLookup ¶
RecursiveDirsLookup ...
func RecursiveFilesLookup ¶
RecursiveFilesLookup ...
func TempFileWithText ¶
TempFileWithText creates the temporary file with the given content, and returns the opened *os.File instance. The file is kept as open, the caller should close the file handle, and remove the file by name.
func TempFilenameWithText ¶
TempFilenameWithText creates the file with the given content, and returns the filename (full path). The caller should remove the file after use.
func Write ¶
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.