filesystem

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB
	PB
)

Variables

View Source
var (
	ErrBadByteSize     = errors.New("invalid bytesize")
	ErrBadByteSizeUnit = errors.New("invalid bytesize unit")
)

Functions

func CopyDir

func CopyDir(src string, dst string) error

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.

func CopyFile

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

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.

func IsDir

func IsDir(path string) bool

IsDir determines whether the specified path is a directory.

func IsExecutable added in v1.1.0

func IsExecutable(file string) bool

IsExecutable path is executable

func IsExists

func IsExists(path string) bool

IsExists path is exists

func IsLink(path string) bool

IsLink path is symlink

func IsReadable added in v1.1.0

func IsReadable(path string) bool

IsReadable path is readable

func IsWritable added in v1.1.0

func IsWritable(path string) bool

IsWritable path is writable

func MustParse

func MustParse(s string) int64

func Parse

func Parse(s string) (int64, error)

func ReadLine

func ReadLine(filePth string) (chan []byte, error)

ReadLine read file line output channel

func TryOpen added in v1.1.0

func TryOpen(path string, flag int) (*os.File, error)

TryOpen 打开一个文件,如果文件不存在,则尝试创建

func WriteToFile

func WriteToFile(filename string, text []byte) error

WriteToFile write byte to file

Types

type Int64

type Int64 int64

func (Int64) AsInt

func (b Int64) AsInt() int

func (Int64) HumanString

func (b Int64) HumanString() string

func (Int64) Int64

func (b Int64) Int64() int64

func (Int64) MarshalText

func (b Int64) MarshalText() ([]byte, error)

func (*Int64) UnmarshalText

func (p *Int64) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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