watcher

package
v0.8.17 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	Pattern  string
	Changed  chan bool
	Debounce time.Duration
	// contains filtered or unexported fields
}

Watcher watches existing os directories that contain Pattern matches for infrequent file changes like manual saving or git-like operations. Directories created after calling New are not watched for FS changes. If FS changes are detected that match Pattern, one "true" is sent to Changed not before Debounce. Changes within the Debounce interval retrigger the Debounce pause, so frequent and continued FS changes will probably never trigger any sending to Changed. Watcher's file system watching routine blocks, if no go routine is listening to Changed. The Changed channel is closed when Close() is called so you can range over Changed.

func New

func New(globPattern string, debounce time.Duration) (*Watcher, error)

New returns a new Watcher that watches all already existing dirs of all os files matching with globPattern

func (*Watcher) Close

func (w *Watcher) Close() error

Close closes the underlying file system watcher

Jump to

Keyboard shortcuts

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