watcher

package
v0.0.0-...-d46617c Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Added represents a file creation event.
	Added = "added"
	// Changed represents a file change event.
	Changed = "changed"
	// Removed represents a file removal event.
	Removed = "removed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Type string
	Path string
}

Event represents a single detected file event.

type Watcher

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

Watcher represents a simple struct for scanning and checking for any changes that occur in a set of watched files and directories.

func New

func New() *Watcher

New instantiates and returns a new watcher struct.

func (*Watcher) Ignore

func (w *Watcher) Ignore(arg string)

Ignore adds a single file, directory, or glob to the file ignore list.

func (*Watcher) NumTargets

func (w *Watcher) NumTargets() (uint64, error)

NumTargets returns the number of currently watched targets.

func (*Watcher) ScanForEvents

func (w *Watcher) ScanForEvents() ([]Event, error)

ScanForEvents returns any events that occurred since the last scan.

func (*Watcher) Watch

func (w *Watcher) Watch(arg string)

Watch adds a single file, directory, or glob to the file watch list.

Jump to

Keyboard shortcuts

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