file

package
v1.1.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsPath

func AbsPath() string

AbsPath 运行目录的绝对路径

func GetFiles

func GetFiles(folder string) []string

GetFiles 获取指定目录下的所有文件

func GetFilesWithExt

func GetFilesWithExt(folder, ext string) []string

GetFilesWithExt 获取文件夹下具有指定文件后缀得文件列表

func GetFolders

func GetFolders(folder string) []string

GetFolders 获取指定目录下的所有目录

func IsExist

func IsExist(file string) bool

IsExist 判断文件是否存在

func MkdirForFile

func MkdirForFile(filepath string, perm os.FileMode)

MkdirForFile 为要访问的文件创建必备的文件夹

func ReadFile

func ReadFile(filename string) (res []byte, err error)

ReadFile 读入文件内容

func WriteFile

func WriteFile(filepath string, content []byte) (err error)

WriteFile 写出文件内容

Types

type Watcher

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

Watcher 监控文件添加行

func NewWatcher added in v1.1.3

func NewWatcher(filename string) (w *Watcher, oldValue string, err error)

NewWatcher 初始化一个监控程序

func (*Watcher) Close

func (w *Watcher) Close()

Close 结束监控,关闭文件

func (*Watcher) ReadLine

func (w *Watcher) ReadLine() (line string, err error)

ReadLine 读入一行的数据

func (*Watcher) Watch

func (w *Watcher) Watch(callback func(line string)) (err error)

Watch 开始进行监控

Jump to

Keyboard shortcuts

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