fileutils

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const BufferSize = 8 * 1024 * 1024

BufferSize define the buffer size when reading and writing file

Variables

This section is empty.

Functions

func CopyFile

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

CopyFile copies the file src to dst.

func CreateDirectory

func CreateDirectory(dirPath string) error

CreateDirectory creates directory recursively.

func DeleteFile

func DeleteFile(filePath string) error

DeleteFile deletes a file not a directory.

func DeleteFiles

func DeleteFiles(filePaths ...string)

DeleteFiles deletes all the given files.

func GetSys

func GetSys(info os.FileInfo) (*syscall.Stat_t, bool)

GetSys returns the underlying data source of the os.FileInfo.

func IsDir

func IsDir(name string) bool

IsDir reports whether the path is a directory.

func IsRegularFile

func IsRegularFile(name string) bool

IsRegularFile reports whether the file is a regular file. If the given file is a symbol link, it will follow the link.

func Link(src string, linkName string) error

Link creates a hard link pointing to src named linkName for a file.

func LoadYaml

func LoadYaml(path string, out interface{}) error

LoadYaml load yaml config file.

func Md5Sum

func Md5Sum(name string) string

Md5Sum generate md5 for a given file

func MoveFile

func MoveFile(src string, dst string) error

MoveFile moves the file src to dst.

func MoveFileAfterCheckMd5

func MoveFileAfterCheckMd5(src string, dst string, md5 string) error

MoveFileAfterCheckMd5 will check whether the file's md5 is equals to the param md5 before move the file src to dst.

func OpenFile

func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

OpenFile open a file. If the parent directory of the file isn't exist, it will create the directory.

func PathExist

func PathExist(name string) bool

PathExist reports whether the path is exist. Any error get from os.Stat, it will return false.

func SymbolicLink(src string, target string) error

SymbolicLink creates target as a symbolic link to src.

Types

This section is empty.

Jump to

Keyboard shortcuts

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