Documentation ¶
Overview ¶
Package fspoll implements a primitive polling-based filesystem watcher.
Index ¶
Constants ¶
View Source
const ( DefaultInterval = 1 * time.Second SleepAfter = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Watcher ¶
type Watcher struct { // event channels Change chan bool Error chan error // contains filtered or unexported fields }
func Watch ¶
func Watch(dir string, excludeGlobs []string, interval, sleepInterval time.Duration) (w *Watcher, err error)
Watch polls the given directory and subdirectories and files inside it, excluding the given globs, for changes with the given interval.
When there was no change for the given interval in 5 minutes, interval changes to sleepInterval (interval * 5 by default). It's back to normal interval if a change is detected. If sleepInterval is negative, don't sleep.
It returns a Watcher or an error.
Click to show internal directories.
Click to hide internal directories.