filetil

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsolutePath

func AbsolutePath(p string) (string, error)

func CopyDir

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

拷贝目录

func CopyFile

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

拷贝文件

func FileExists

func FileExists(path string) bool

FileExists reports whether the named file or directory exists.

func FormatBytes

func FormatBytes(size int64) string

func HasFileOfExt

func HasFileOfExt(path string, exts []string) bool

判断指定目录下是否存在指定后缀的文件

func ReadFileAndIgnoreUTF8BOM

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

忽略字符串中的BOM头

func RemoveDir

func RemoveDir(dir string) error

func Round

func Round(val float64, places int) float64

Types

type FileList

type FileList struct {
	IsDir   bool   //是否是目录
	Path    string //文件路径
	Ext     string //文件扩展名
	Name    string //文件名
	Size    int64  //文件大小
	ModTime int64  //文件修改时间戳
}

返回的目录扫描结果

func ScanFiles

func ScanFiles(dir string) (fl []FileList, err error)

目录扫描 @param dir 需要扫描的目录 @return fl 文件列表 @return err 错误

Jump to

Keyboard shortcuts

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