file

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package file @Title file.go @Description @Author haogooder @Update 2022/2/8

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(filePath string) bool

文件是否存在

func FileModTime

func FileModTime(filename string) (int64, error)

文件最后修改时间

func OpenNewFile

func OpenNewFile(fileName, bakExt string, isBak bool) (fp *os.File, err error)

打开文件,得到一个句柄。如果不存在创建一个,如果存在再判断

Types

type FileIterator

type FileIterator struct {
	// contains filtered or unexported fields
}

func NewFileIterator

func NewFileIterator() *FileIterator

func (*FileIterator) Init

func (fi *FileIterator) Init() (*FileIterator, error)

Init 初始化操作

func (*FileIterator) IterLine

func (fi *FileIterator) IterLine(fn IteratorLineFunc)

返回一个可遍历的通道

func (*FileIterator) SetFile

func (fi *FileIterator) SetFile(f string) *FileIterator

设置文件

type FileTool

type FileTool struct {
	// contains filtered or unexported fields
}

func NewFileTool

func NewFileTool() *FileTool

func (*FileTool) Init

func (ft *FileTool) Init()

初始化操作

func (*FileTool) IsExists

func (ft *FileTool) IsExists(f string) bool

判断文件或目录是否存在

func (*FileTool) ReadDirFiles

func (ft *FileTool) ReadDirFiles(dir string) ([]string, error)

读取目录下的所有文件

type IteratorLineFunc

type IteratorLineFunc func(string)

Jump to

Keyboard shortcuts

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