Categorygithub.com/workshop-depot/dirwatch
modulepackage
0.4.3
Repository: https://github.com/workshop-depot/dirwatch.git
Documentation: pkg.go.dev

# README

dirwatch

For watching for changes inside a directory and all sub-directories, recursively. Uses the package fsnotify.

Documentation:

GoDoc

Sample Usage

notify := func(ev Event) {
	// processing the event ev
}

// create the watcher which excludes
// any folder along the added paths
// that matches provided pattern(s).
watcher := New(Notify(notify), Exclude("/*/*/node_modules"))
defer watcher.Stop()
watcher.Add(dir1, true)
watcher.Add(dir2, false)
watcher.Add(dir3, true)

Environment:

  • Ubuntu 18.04
  • Go 1.10.3

TODO:

  • more tests

# Functions

Exclude sets patterns to exclude from watch.
Logger sets the logger for the watcher.
New creates a new *Watcher.
Notify sets the notify callback.

# Structs

Event represents a single file system notification.
Watcher watches over a directory and it's sub-directories, recursively.

# Type aliases

Option modifies the options.