Documentation ¶
Overview ¶
Package fsnotify implements filesystem notification.
Index ¶
Examples ¶
Constants ¶
View Source
const ( FSN_CREATE = 1 FSN_MODIFY = 2 FSN_DELETE = 4 FSN_RENAME = 8 FSN_ALL = FSN_MODIFY | FSN_DELETE | FSN_RENAME | FSN_CREATE )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileEvent ¶
type FileEvent struct { Name string // File name (optional) // contains filtered or unexported fields }
Event is the type of the notification messages received on the watcher's Event channel.
func (*FileEvent) IsModify ¶
IsModify reports whether the FileEvent was triggerd by a file modification or attribute change
type Watcher ¶
type Watcher struct { Event chan *FileEvent // Events are returned on this channel Error chan error // Errors are sent on this channel // contains filtered or unexported fields }
A Watcher waits for and receives event notifications for a specific set of files and directories.
func NewWatcher ¶
NewWatcher creates and returns a Watcher.
Example ¶
package main import ( "log" "github.com/howeyc/fsnotify" ) func main() { watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } go func() { for { select { case ev := <-watcher.Event: log.Println("event:", ev) case err := <-watcher.Error: log.Println("error:", err) } } }() err = watcher.Watch("/tmp/foo") if err != nil { log.Fatal(err) } }
Output:
func (*Watcher) Close ¶
Close closes a Watcher. It sends a message to the reader goroutine to quit and removes all watches associated with the watcher.
func (*Watcher) RemoveWatch ¶
Remove a watch on a file
Click to show internal directories.
Click to hide internal directories.