Documentation
¶
Index ¶
- Constants
- Variables
- func CreateFile(fpath string, filePerm, dirPerm os.FileMode) (*os.File, error)
- func DeleteIfFileExist(fpath string) error
- func FileExists(path string) bool
- func IsAbsPath(filepath string) bool
- func IsDir(path string) bool
- func IsFile(path string) bool
- func IsImageFile(path string) bool
- func IsZipFile(filepath string) bool
- func MimeType(path string) (mime string)
- func Mkdir(dirPath string, perm os.FileMode) error
- func MustReadFile(filePath string) []byte
- func OpenFile(filepath string, flag int, perm int) (*os.File, error)
- func PathExists(path string) bool
- func ReaderMimeType(r io.Reader) (mime string)
- func Unzip(archive, targetDir string) (err error)
- type FileFinder
Constants ¶
View Source
const (
// sniff Length, use for detect file mime type
MimeSniffLen = 512
)
Variables ¶
Functions ¶
func CreateFile ¶ added in v0.2.10
CreateFile if not exists Usage:
CreateFile("path/to/file.txt", 0664, 0666)
func DeleteIfFileExist ¶ added in v0.2.10
DeleteIfFileExist operate
func FileExists ¶
FileExists reports whether the named file or directory exists.
func IsImageFile ¶ added in v0.2.5
IsImageFile check file is image file.
func IsZipFile ¶
IsZipFile check is zip file. from https://blog.csdn.net/wangshubo1989/article/details/71743374
func MustReadFile ¶ added in v0.3.7
MustReadFile read file contents, will panic on error
func PathExists ¶ added in v0.2.1
PathExists reports whether the named file or directory exists.
func ReaderMimeType ¶ added in v0.2.5
ReaderMimeType get the io.Reader mimeType Usage:
file, err := os.Open(filepath)
if err != nil {
return
}
mime := ReaderMimeType(file)
func Unzip ¶
Unzip a zip archive from https://blog.csdn.net/wangshubo1989/article/details/71743374
Types ¶
Click to show internal directories.
Click to hide internal directories.