fswatcher

package
v0.0.0-...-d30b894 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(error)

ErrorHandler the fsnotify error handler

type FileWatcher

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

FileWatcher the file fswatcher struct

func NewWatcher

func NewWatcher() (*FileWatcher, error)

NewWatcher create the new fswatcher

func (*FileWatcher) AddHandler

func (fw *FileWatcher) AddHandler(handler Handler) error

AddHandler add file fswatcher handler

func (*FileWatcher) AddWatch

func (fw *FileWatcher) AddWatch(path string, subDir bool) error

AddWatch add path to watch path: the path to watch subDir: true to watch the sub directory; false to not watch the sub directory

func (*FileWatcher) RemoveWatch

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

RemoveWatch remove the path from fswatcher. And then, the system will stop watching the changes.

func (*FileWatcher) SetErrorHandler

func (fw *FileWatcher) SetErrorHandler(h ErrorHandler)

SetErrorHandler set the fsnotify error handler

func (*FileWatcher) Start

func (fw *FileWatcher) Start()

Start star the file fswatcher

func (*FileWatcher) Stop

func (fw *FileWatcher) Stop()

type Handler

type Handler interface {
	CanHandle(path string) bool
	Handle(ev *fsnotify.Event)
}

Handler the fswatcher handler interface

Jump to

Keyboard shortcuts

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