fsnotify: github.com/fsnotify/fsnotify Index | Files

package fsnotify

import "github.com/fsnotify/fsnotify"

Package fsnotify provides a platform-independent interface for file system notifications.

Index

Package Files

fsnotify.go inotify.go inotify_poller.go

Variables

var (
    ErrEventOverflow = errors.New("fsnotify queue overflow")
)

Common errors that can be reported by a watcher

type Event Uses

type Event struct {
    Name string // Relative path to the file or directory.
    Op   Op     // File operation that triggered the event.
}

Event represents a single file system notification.

func (Event) String Uses

func (e Event) String() string

String returns a string representation of the event in the form "file: REMOVE|WRITE|..."

type Op Uses

type Op uint32

Op describes a set of file operations.

const (
    Create Op  = 1 << iota
    Write
    Remove
    Rename
    Chmod
)

These are the generalized file operations that can trigger a notification.

func (Op) String Uses

func (op Op) String() string

type Watcher Uses

type Watcher struct {
    Events chan Event
    Errors chan error
    // contains filtered or unexported fields
}

Watcher watches a set of files, delivering events to a channel.

func NewWatcher Uses

func NewWatcher() (*Watcher, error)

NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.

func (*Watcher) Add Uses

func (w *Watcher) Add(name string) error

Add starts watching the named file or directory (non-recursively).

func (*Watcher) Close Uses

func (w *Watcher) Close() error

Close removes all watches and closes the events channel.

func (*Watcher) Remove Uses

func (w *Watcher) Remove(name string) error

Remove stops watching the named file or directory (non-recursively).

Package fsnotify imports 10 packages (graph) and is imported by 1733 packages. Updated 2020-04-27. Refresh now. Tools for package owners.