fswatch

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpNone none operation
	OpNone = Op(0)

	// OpCreate create operation
	OpCreate = Op(fsnotify.Create)

	// OpWrite write operation
	OpWrite = Op(fsnotify.Write)

	// OpRemove remove operation
	OpRemove = Op(fsnotify.Remove)

	// OpRename rename operation
	OpRename = Op(fsnotify.Rename)

	// OpChmod chmod operation
	OpChmod = Op(fsnotify.Chmod)

	// OpModifies modifies operations (OpCreate | OpWrite | OpRemove | OpRename)
	OpModifies = OpCreate | OpWrite | OpRemove | OpRename

	// OpALL all operations
	OpALL = Op(0xFFFFFFFF)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWatcher

type FileWatcher struct {
	Delay  time.Duration // Event delay
	Logger log.Logger    // Error logger
	// contains filtered or unexported fields
}

FileWatcher struct for file watching

func NewFileWatcher

func NewFileWatcher() *FileWatcher

NewFileWatcher create a FileWatcher

func (*FileWatcher) Add

func (fw *FileWatcher) Add(path string, op Op, callback func(string, Op)) error

Add add a file to watch on specified operation op occured

func (*FileWatcher) AddRecursive

func (fw *FileWatcher) AddRecursive(path string, op Op, fn string, cb func(string, Op)) error

AddRecursive add files and all sub-directories under the path to watch op: operation mask fn: file path wildcard mask, "" or "*" means no mask

func (*FileWatcher) Remove

func (fw *FileWatcher) Remove(path string) error

Remove stop watching the file

func (*FileWatcher) RemoveRecursive

func (fw *FileWatcher) RemoveRecursive(path string) error

RemoveRecursive stops watching the directory and all sub-directories.

func (*FileWatcher) Start

func (fw *FileWatcher) Start() (err error)

Start start file watching go-routine

func (*FileWatcher) Stop

func (fw *FileWatcher) Stop() (err error)

Stop stop file watching go-routine

type Op

type Op = fsnotify.Op

Op describes a set of file operations.

Jump to

Keyboard shortcuts

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