Documentation
¶
Index ¶
- func AppendStrWithWriter(writer *bufio.Writer, content string) (w *bufio.Writer, re error)
- func CheckExist(src string) bool
- func CheckFileExist(filepath string) bool
- func CheckPermission(src string) bool
- func CopyFile(source, target string, over bool) error
- func CreatePath(path string, perm os.FileMode) bool
- func CreatePathWithDefaultMode(path string) string
- func CurrPath() string
- func CurrPath2() string
- func DeleteFile(target string)
- func Exist(path string) bool
- func FileMD5(filePath string) (string, error)
- func FormatSize(fileSize int64) (size string)
- func GetAbs(path string) string
- func GetCurrentAbPath() string
- func GetCurrentAbPathByCaller() string
- func GetCurrentAbPathByExecutable() string
- func GetCurrentProjectPath() string
- func GetExt(fileName string) string
- func GetFileMode(num int) os.FileMode
- func GetFileSize(filename string) (int64, error)
- func GetFileSizeByFormat(filename string) (string, error)
- func GetFiles(path string, filter func(name string, isDir bool) bool, option GetFilesOption) ([]string, error)
- func GetImgType(p string) (string, error)
- func GetName(filePath string) string
- func GetPrePath(ps string) string
- func GetSize(f multipart.File) (int, error)
- func GetSubDirs(path string, filter func(name string) bool) ([]string, error)
- func GetTmpDir() string
- func GetType(p string) (string, error)
- func IsNotExistMkDir(src string) error
- func Join(str ...string) string
- func LastPathName(fp string) string
- func MkDir(src string) error
- func MkDirByMode(src string, model os.FileMode) error
- func MoveFile(source, target string)
- func Open(name string, flag int, perm os.FileMode) (*os.File, error)
- func ReadFile(filePath string) (string, error)
- func ReplaceStr(src, dst string, rmap map[string]string) error
- func Walk(basePath string, filer func(name string, isDir bool) bool, ...) ([]string, error)
- func WalkDir(basePath string, filer func(name string) bool, option GetFilesOption) ([]string, error)
- func WriteFile(filePath string, content string) (re error)
- func WriteFileByBytes(content bytes.Buffer, name string)
- func WriteFileByMode(nameWithPath string, data []byte, perm os.FileMode) error
- type GetFilesOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStrWithWriter ¶
func DeleteFile ¶
func DeleteFile(target string)
func GetCurrentProjectPath ¶
func GetCurrentProjectPath() string
func GetFileSizeByFormat ¶
func LastPathName ¶
func MkDirByMode ¶
*
if err := fileUtil.MkDirByMode(file, 0700); err != nil {
return gm.FailureResultWithError[string](500, fmt.Errorf("Could not create directory %s", file))
}
func WalkDir ¶
func WalkDir(basePath string, filer func(name string) bool, option GetFilesOption) ([]string, error)
WalkDir 获取符合条件的子目录 TODO: 当碰到已符合条件的目录后,是否继续查这个目录下的子目录? 这个还未实现
func WriteFileByBytes ¶
Types ¶
type GetFilesOption ¶
type GetFilesOption struct {
// contains filtered or unexported fields
}
func NewGetFilesOption ¶
func NewGetFilesOption() GetFilesOption
Click to show internal directories.
Click to hide internal directories.