fileUtil

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStrWithWriter

func AppendStrWithWriter(writer *bufio.Writer, content string) (w *bufio.Writer, re error)

func CheckExist

func CheckExist(src string) bool

CheckExist 检查文件是否存在

func CheckPermission

func CheckPermission(src string) bool

CheckPermission 检查文件权限

func CopyFile

func CopyFile(source, target string, over bool) error

over 是否覆盖

func CreatePath

func CreatePath(path string, perm os.FileMode) (bool, error)

func CreatePathWithDefaultMode

func CreatePathWithDefaultMode(path string) string

func CurrPath

func CurrPath() string

func DeleteFile

func DeleteFile(target string)

func Exist

func Exist(path string) (bool, error)

func FormatSize added in v1.0.1

func FormatSize(fileSize int64) (size string)

FormatSize 转换文件大小的单位

func GetExt

func GetExt(fileName string) string

GetExt 获取文件后缀

func GetFileMode

func GetFileMode(num int) os.FileMode

func GetFiles

func GetFiles(path string, filter func(name string, dir bool) bool, option GetFilesOption) ([]string, error)

func GetImgType

func GetImgType(p string) (string, error)

GetImgType 获取Img文件类型

func GetSize

func GetSize(f multipart.File) (int, error)

GetSize 获取文件大小

func GetSubDirs

func GetSubDirs(path string, filter func(name string) bool) ([]string, error)

func GetType

func GetType(p string) (string, error)

GetType 获取文件类型

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir 检查文件夹是否存在 如果不存在则新建文件夹

func Join

func Join(str ...string) string

func LastPathName

func LastPathName(fullpath string) string

func MkDir

func MkDir(src string) error

MkDir 新建文件夹

func MoveFile

func MoveFile(source, target string)

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open 打开文件

func ReadFile

func ReadFile(filePath string) (string, error)

func ReplaceStr

func ReplaceStr(src, dst string, rmap map[string]string) error

func WriteFile

func WriteFile(filePath string, content string) (re error)

Types

type GetFilesOption

type GetFilesOption struct {
	// contains filtered or unexported fields
}

func NewGetFilesOption

func NewGetFilesOption() GetFilesOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL