fsnotify

package module
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: BSD-3-Clause Imports: 10 Imported by: 9,958

README

WARNING

If you are reading this, you use master branch of this repository, which is wrong.

This branch

  • should not be used;
  • is not maintained;
  • is not supported;
  • will be removed soon.

You should switch to using the default branch instead.

Using git

Here's how to switch your existing local copy of this repository from master to main (assuming the remote name is origin):

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

In addition to the above, if you want to remove the leftover origin/master remote branch (NOTE this also removes all other remote branches that no longer exist in origin):

git remote prune origin

Background

The master branch was renamed to main, causing an issue with Yocto/OpenEmbedded's meta-virtualization layer, which explicitly refers to master branch of this repository (see #426).

This temporary branch is created to alleviate the Yocto/OE issue.

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Common errors that can be reported by a watcher

Functions

This section is empty.

Types

type Event added in v1.0.0

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 added in v1.0.0

func (e Event) String() string

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

type Op added in v1.0.0

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 added in v1.4.0

func (op Op) String() string

type Watcher

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

func NewWatcher() (*Watcher, error)

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

func (*Watcher) Add added in v1.0.0

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

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

func (*Watcher) Close

func (w *Watcher) Close() error

Close removes all watches and closes the events channel.

func (*Watcher) Remove added in v1.0.0

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

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

Jump to

Keyboard shortcuts

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