fsnotify

package
v2.25.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 2 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Create          = Op(fsnotify.Create)
	Remove          = Op(fsnotify.Remove)
	Rename          = Op(fsnotify.Rename)
	Chmod           = Op(fsnotify.Chmod)
	Write           = Op(fsnotify.Write)
	WatchingResumed = Op(1 << 31)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Path to the file or directory.
	//
	// Paths are relative to the input; for example with Add("dir") the Name
	// will be set to "dir/file" if you create that file, but if you use
	// Add("/path/to/dir") it will be "/path/to/dir/file".
	Name string

	// File operation that triggered the event.
	//
	// This is a bitmask and some systems may send multiple operations at once.
	// Use the Event.Has() method instead of comparing with ==.
	Op Op
}

Event represents a file system notification.

func (Event) String added in v2.7.17

func (e Event) String() string

String returns a string representation of the event with their path.

type Op added in v2.7.17

type Op fsnotify.Op

Op describes a set of file operations.

func (Op) String added in v2.7.17

func (op Op) String() string

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(logger log.Logger) (*Watcher, error)

NewWatcher creates a new Watcher. It's allows to watch a single file or a directory multiple times.

func (*Watcher) Add

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

func (*Watcher) AddOnEventHandler

func (w *Watcher) AddOnEventHandler(onEventHandler *func(event Event))

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) Remove

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

func (*Watcher) RemoveOnEventHandler

func (w *Watcher) RemoveOnEventHandler(onEventHandler *func(event Event))

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL