fileutil

package
v0.2.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 FileExt

func FileExt(filePathName string) string

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 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

Types

This section is empty.

Jump to

Keyboard shortcuts

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