# README
Watcher
A no-nonsense wrapper around the fsnotify package.
Install
$ go get github.com/wilhelm-murdoch/go-watcher
Reference
Function New
New creates a new instance of a Watcher struct.
Function AddPath
AddFile adds a single valid file to the current Watcher instance and returns an error if the file is not valid.
Function WalkPath
AddDir will recursively walk the specified directory tree and add all valid files to the current watcher instance for monitoring.
Function AddGlob
AddGlob will monitor the specified "glob" pattern and add all valid files to the current watcher instance for monitoring.
Function On
func (w *Watcher) On(event fsnotify.Op, f func(fsnotify.Event, os.FileInfo, error) error) error
#watcher.go:75:94
#
On fires off an assigned callback for each event type. Only specified events are supported and all will return either nil or an error. Every watcher instance exits when it first encounters an error.
Function All
All will fire off the specified callback on any supported fsnotify
event.
Function Watch
Watch creates a new errgroup
instance and monitors for changes to any of the specified files. All supported event types will fire off specified callbacks if available. This method exits on the first encountered error.
package main
import (
"fmt"
"strings"
"github.com/wilhelm-murdoch/go-play"
)
func main() {
}
Function List
List is a wrapper around fsnotify.Watchlist()
. It returns a list of strings representing all files and directories currently monitored instance of fsnotify
.
Function Done
Done signals a blocking channel that processing is complete and that we can safely exit the current watcher instance.
Documentation generated by Gadget.
License
Copyright © 2022 Wilhelm Murdoch.
This project is MIT licensed.