fileutil

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPathSepIfNeed

func AddPathSepIfNeed(path string) (newPath string)

func CreateDirRecursive

func CreateDirRecursive(filePath string) error

递归创建文件夹

func DirSize added in v1.0.0

func DirSize(path string) (int64, error)

func FileNameToJpgFileName

func FileNameToJpgFileName(onlyFilename string) string

func GetFilePath added in v1.0.0

func GetFilePath(fullfilename string) string

/a/b/c.txt -> /a/b/

func GetFilePathAndName added in v1.0.0

func GetFilePathAndName(fullfilename string) (string, string)

/a/b/c.txt -> /a/b/, c.txt

func GetFileSuffix added in v1.0.0

func GetFileSuffix(fullfilename string) string

/a/b/c.txt -> .txt

func GetFilename added in v1.0.0

func GetFilename(fullfilename string) string

/a/b/c.txt -> c.txt

func GetFilenameOnly

func GetFilenameOnly(fullfilename string) string

/a/b/c.txt -> c

func IsFile

func IsFile(f string) (isFile bool, err error)

如果是单个文件则返回 true.

func IsFileExist

func IsFileExist(f string) bool

func IsFileNotExist

func IsFileNotExist(f string) bool

func IsImage

func IsImage(filename string) bool

func IsMediaFile

func IsMediaFile(filename string) bool

func IsVideo

func IsVideo(filename string) bool

func IsVideoExt added in v1.0.0

func IsVideoExt(ext string) bool

func ListDir added in v1.0.0

func ListDir(folder string) ([]string, error)

func MoveFile added in v1.0.0

func MoveFile(file, targetDirWithoutTargetName string) error

func ReadFromFile

func ReadFromFile(filename string) (error, []byte)

func SearchEmptyFoldersAndFiles added in v1.0.0

func SearchEmptyFoldersAndFiles(d string) ([]string, error)

func WriteToFile

func WriteToFile(filename string, content []byte, truncateIfExist bool) error

func WriteToFileWithFlag added in v1.0.2

func WriteToFileWithFlag(filename string, content []byte, flag int) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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