watcher

package module
v1.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 9 Imported by: 0

README

go-watcher

go fs watcher base fsnotify/fsnotify

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Op
	FromPath string
	FromInfo os.FileInfo
	ToPath   string
	ToInfo   os.FileInfo
}

func (*Event) String

func (e *Event) String() string

type Op

type Op uint
const (
	Create Op = 1 << iota
	Update
	MoveTo
	Remove
	Rename
	Chmod
	AllOps = Create | Update | MoveTo | Remove | Rename | Chmod
)

func (Op) String

func (op Op) String() string

type Option

type Option func(*Watcher)

func WithContext

func WithContext(ctx context.Context) Option

func WithIgnorePattern

func WithIgnorePattern(pattern string) Option

func WithMaxEvents

func WithMaxEvents(delta int) Option

func WithOpFilter

func WithOpFilter(ops Op) Option

type Watcher

type Watcher struct {
	Events chan Event
	Errors chan error
	// contains filtered or unexported fields
}

func New

func New(path string, opt ...Option) (*Watcher, error)

func (*Watcher) Close

func (w *Watcher) Close() error

watcher 关闭

func (*Watcher) SetFilterEvents

func (w *Watcher) SetFilterEvents(ops Op)

过滤事件

func (*Watcher) SetMaxEvents

func (w *Watcher) SetMaxEvents(delta int)

func (*Watcher) Start

func (w *Watcher) Start()

func (*Watcher) WatchedList

func (w *Watcher) WatchedList() map[string]os.FileInfo

获取已监控列表

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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