file

package
v0.0.0-...-95be442 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStringToFile

func AppendStringToFile(content string, filePath string) error

AppendStringToFile append string to file

func BytesToFile

func BytesToFile(data []byte, filepath string) error

BytesToFile 字节数组写入到文件

func CurrentDir

func CurrentDir() string

CurrentDir 获取当前路径

func Exist

func Exist(path string) (existed bool, isDir bool)

Exist reports whether the file or directory exists.

func Exists

func Exists(path string) (existed bool)

Exists reports whether the file or directory exists.

func GetDirList

func GetDirList(path string) ([]string, error)

GetDirList get directory list

func GetDirListWithFilter

func GetDirListWithFilter(path string, filter Filter) ([]string, error)

GetDirListWithFilter get directory list with filter

func GetFilepaths

func GetFilepaths(dir string) ([]string, error)

GetFilepaths get all filepaths in a directory tree

func IsExist

func IsExist(name string) bool

IsExist 文件或目录是否存在 return false 表示文件不存在

func Mode

func Mode(path string) os.FileMode

Mode get file mode

func RecreateDir

func RecreateDir(dir string) error

RecreateDir recreate dir

func WriteStringToFile

func WriteStringToFile(content, path string, mode os.FileMode) (err error)

WriteStringToFile write string to file

Types

type File

type File struct {
	Path    string
	Content string
}

File template file

func GetFiles

func GetFiles(dir string) ([]*File, error)

GetFiles get files

type Filter

type Filter func(os.FileInfo) bool

Filter file filter

Jump to

Keyboard shortcuts

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