fswatcher

package
v0.0.0-...-d07a634 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MIN_INTERVAL = time.Millisecond * 20

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Name    string // Path to the file or directory
	NewPath string // new path after rename operation
	Op      Op     // File operation that triggered the event.
}

Event represents a single file system notification

type FsWatcher

type FsWatcher interface {
	Events() <-chan Event
	Errors() <-chan error
	Add(name string) (map[string]*fs.FileInfo, error)
	Remove(name string) error
	Close() error
	Start(interval time.Duration) error
	Stop()
	AddShouldSkipHook(func(fi fs.FileInfo) bool)
	SendEvent(ev Event) error
	ScanComplete() <-chan struct{}
	Scan()
}

FsWatcher is fsnotify-like interface for implementing file watchers

func NewFsPoller

func NewFsPoller(fsys fs.FS, root string) FsWatcher

New creates a new Watcher.

type Op

type Op uint32

Op describes a type of event

const (
	Create Op = 1 << iota
	Write
	Remove
	Rename
	Chmod
)

Operations

func (Op) String

func (op Op) String() string

Jump to

Keyboard shortcuts

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