files

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
}

func NewFile

func NewFile() *File

func (*File) AppendWriteFile

func (*File) AppendWriteFile(filePath string, body []byte) (writerLen int, err error)

追加写入

func (*File) CreateFile

func (*File) CreateFile(filePath string, body []byte) (writerLen int64, err error)

覆盖写入文件

func (*File) CreateFileByNot

func (obj *File) CreateFileByNot(filePath string) error

如果文件夹不存在,则递归创建文件夹

func (*File) FileSize

func (*File) FileSize(file string) int64

获取文件大小

func (*File) IsBinary

func (*File) IsBinary(content string) bool

IsBinary determines whether the specified content is a binary file content.

func (*File) IsExist

func (*File) IsExist(path string) bool

判断所给路径文件/文件夹是否存在

func (*File) ReadAll

func (*File) ReadAll(fielPath string) ([]byte, error)

一次性读取文件所有内容

func (*File) ReadAllOnLine

func (*File) ReadAllOnLine(fielPath string, callBak func(row string) bool)

一次性加载文件,按行读取

func (*File) ReadOnLine

func (*File) ReadOnLine(fielPath string, callBak func(row string) bool)

逐行读取文件

func (File) WriteFileSafer

func (File) WriteFileSafer(writePath string, data []byte, perm os.FileMode) error

WriteFileSafer writes the data to a temp file and atomically move if everything else succeeds.

type Folder

type Folder struct {
}

func NewFolder

func NewFolder() *Folder

func (*Folder) IsDir

func (*Folder) IsDir(path string) bool

func (*Folder) ReadDirs

func (*Folder) ReadDirs(dir string) ([]string, error)

读取目录中的目录

func (*Folder) ReadFiles

func (*Folder) ReadFiles(dir string) (fileList []os.FileInfo, err error)

获取当前文件夹中的所有文件

func (*Folder) ReadFilesByOrderNum

func (*Folder) ReadFilesByOrderNum(dir string) (fileList []string, err error)

读取目录文件并按文件名中的数字排序

func (*Folder) ReadFilesToStr

func (*Folder) ReadFilesToStr(dir string) (fileList []string, err error)

获取当前文件夹中的所有文件

Jump to

Keyboard shortcuts

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