file

package
v0.0.0-...-59c608d Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2023 License: GPL-3.0 Imports: 6 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpFile

func DumpFile(path, content string) error

DumpFile 保存到文件

func GetAbsPath

func GetAbsPath(path string) string

GetAbsPath 获取绝对路径

Types

type Helper

type Helper struct {
	os.File
	Path    string
	AbsPath string
	Handle  *os.File
}

Helper 文件帮助类

func Open

func Open(path string, createIfNotExists, appendMode bool) (*Helper, error)

Open 打开文件

func (*Helper) Close

func (h *Helper) Close() error

Close 关闭文件

func (*Helper) CreateTime

func (h *Helper) CreateTime() (int64, error)

CreateTime 获取文件的创建时间

func (*Helper) Info

func (h *Helper) Info() (os.FileInfo, error)

Info 获取文件信息

func (*Helper) IsExist

func (h *Helper) IsExist(path string) bool

IsExist 判断文件是否存在

func (*Helper) IsFile

func (h *Helper) IsFile(path string) bool

IsFile 判断是否为文件

func (*Helper) Open

func (h *Helper) Open(path string, createIfNotExists, appendMode bool) (*os.File, error)

Open 打开文件

func (*Helper) ReadEx

func (h *Helper) ReadEx(buff []byte, offset int64, unzipFile bool) (int, error)

ReadEx 读取文件

func (*Helper) Remove

func (h *Helper) Remove() error

Remove 删除文件

func (*Helper) Rename

func (h *Helper) Rename(newPath string) error

Rename 重命名文件

func (*Helper) Size

func (h *Helper) Size() (int64, error)

Size 获取文件大小

func (*Helper) WriteEx

func (h *Helper) WriteEx(data []byte, offset int64, zipFile bool) (int, error)

WriteEx 写入文件:zipFile - 是否压缩文件

func (*Helper) WriteStringEx

func (h *Helper) WriteStringEx(content string) (int, error)

WriteStringEx 将字符串写入文件

Jump to

Keyboard shortcuts

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