fileutil

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDir added in v0.2.19

func BuildDir(absDir string) error

BuildDir 创建目录

func CheckFileIsExist added in v0.2.19

func CheckFileIsExist(filename string) bool

CheckFileIsExist 检查目录是否存在

func CheckNotExist

func CheckNotExist(src string) bool

CheckNotExist check if the file exists

func CheckPermission

func CheckPermission(src string) bool

CheckPermission check if the file has permission

func Copy added in v0.1.25

func Copy(source string, dest string, fn func(path string, info os.FileInfo) bool) (err error)

CopyFile copies the source file to the dest file.

func CopyDir

func CopyDir(source string, dest string) (err error)

CopyDir copies the source directory to the dest directory.

func CopyFile

func CopyFile(source string, dest string) (err error)

CopyFile copies the source file to the dest file.

func DeleteFile added in v0.2.19

func DeleteFile(absDir string) error

DeleteFile 删除文件或文件夹

func FileExt

func FileExt(filePathName string) string

func GetCurrentDirectory added in v0.2.19

func GetCurrentDirectory() string

GetCurrentDirectory 获取程序运行路径

func GetExt

func GetExt(fileName string) string

GetExt get the file ext

func GetFileSize

func GetFileSize(path string) (i int64, err error)

GetFileSize get the length in bytes of file of the specified path.

func GetImageName

func GetImageName(name string) string

GetImageName get image hash name

func GetModelPath added in v0.2.19

func GetModelPath() string

GetModelPath 获取目录地址

func GetPathDirs added in v0.2.19

func GetPathDirs(absDir string) (re []string)

GetPathDirs 获取目录所有文件夹

func GetPathFiles added in v0.2.19

func GetPathFiles(absDir string) (re []string)

GetPathFiles 获取目录所有文件

func GetSize

func GetSize(r io.Reader) (i int, err error)

GetSize get the file size

func GrepFile

func GrepFile(patten string, filename string) (lines []string, err error)

GrepFile like command grep -E for example: GrepFile(`^hello`, "hello.txt") \n is striped while read

func IsBinary

func IsBinary(content string) bool

IsBinary determines whether the specified content is a binary file content.

func IsDir

func IsDir(path string) bool

IsDir determines whether the specified path is a directory.

func IsExist

func IsExist(path string) bool

IsExist determines whether the file spcified by the given path is exists.

func IsImg

func IsImg(extension string) bool

IsImg determines whether the specified extension is a image.

func IsNotExistMkDir

func IsNotExistMkDir(src string) (err error)

IsNotExistMkDir create a directory if it does not exist

func MkDir

func MkDir(src string) (err error)

MkDir create a directory

func MustOpen

func MustOpen(fileName, filePath string) (f *os.File, err error)

MustOpen maximize trying to open the file

func Open

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

Open a file according to a specific mode

func ReadFile added in v0.2.19

func ReadFile(fname string) (src []string)

ReadFile 读取文件

func WriteFile added in v0.2.19

func WriteFile(fname string, src []string, isClear bool) bool

WriteFile 写入文件

Types

This section is empty.

Jump to

Keyboard shortcuts

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