file

package
v1.20.57 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Zlib Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotModified = errors.New("file not modified")

Functions

func CopyFile added in v1.0.54

func CopyFile(old, new string) error

CopyFile is used to copy a file

func CopyN added in v1.0.59

func CopyN(writer io.Writer, src io.Reader, size int64) (int64, error)

func CreateFile added in v1.8.68

func CreateFile(filename string, perm os.FileMode) (*os.File, error)

func CreatePath added in v1.6.11

func CreatePath(path string) error

func DecodeFileModifyTime added in v1.8.65

func DecodeFileModifyTime(filename string, lastModifyTime int64, decoder DecodeFunc) (int64, interface{}, error)

func DirEmpty added in v1.1.11

func DirEmpty(path string) bool

DirEmpty 目录是否为空

func IsDir

func IsDir(f string) int

func IsExist

func IsExist(f string) bool

IsExist 文件或目录

func IsFile

func IsFile(f string) bool

func MD5 added in v1.8.75

func MD5(filename string) string

func MD5Byte added in v1.8.75

func MD5Byte(src io.Reader) []byte

func MD5ByteSize added in v1.8.75

func MD5ByteSize(src io.Reader) ([]byte, int64)

MD5ByteSize return md5 bytes and file's size

func MD5Reader added in v1.8.75

func MD5Reader(src io.Reader) string

func MD5Size added in v1.8.75

func MD5Size(src io.Reader) (string, int64)

MD5Size return md5 hex(32) and file's size

func Open added in v1.1.11

func Open(filename string) (*os.File, int64, error)

func Read added in v1.0.56

func Read(f io.Reader, size int) ([]byte, error)

func ReadDir added in v1.8.69

func ReadDir(path string, depth *Depth, handler func(name string, isDir bool, entry os.DirEntry) int) error

ReadDir handler return 1: ignore, 0: ok, other: err

func ReadFile added in v1.0.56

func ReadFile(f *os.File) ([]byte, error)

func ReadFileModifyTime added in v1.8.65

func ReadFileModifyTime(filename string, lastModifyTime int64) (int64, []byte, error)

func ReadFileName added in v1.8.68

func ReadFileName(filename string, reader func(r *os.File) error) (int64, error)

func Write added in v1.1.33

func Write(filename string, src io.Reader, perm os.FileMode) error

func WriteFileName added in v1.8.68

func WriteFileName(filename string, perm os.FileMode, writer func(w *os.File) error) error

func WriteOut added in v1.9.4

func WriteOut(filename string, src io.Reader, perm os.FileMode, outer func(w *os.File) error) error

Types

type DecodeFunc added in v1.8.65

type DecodeFunc func(v []byte) (interface{}, error)

type Depth added in v1.8.69

type Depth struct {
	Depth int
	// contains filtered or unexported fields
}

func WithDepth added in v1.8.69

func WithDepth(depth int) Depth

func WithMaxDepth added in v1.8.69

func WithMaxDepth() Depth

Directories

Path Synopsis
*
*

Jump to

Keyboard shortcuts

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