Documentation ¶
Index ¶
- Constants
- func Add(path string, op Op, callback func(string, Op)) error
- func AddRecursive(path string, op Op, cb func(string, Op)) error
- func Remove(path string) error
- func RemoveRecursive(path string) error
- func Start() (err error)
- func Stop() (err error)
- type FileWatcher
- func (fw *FileWatcher) Add(path string, op Op, callback func(string, Op)) error
- func (fw *FileWatcher) AddRecursive(path string, op Op, cb func(string, Op)) error
- func (fw *FileWatcher) Remove(path string) error
- func (fw *FileWatcher) RemoveRecursive(path string) error
- func (fw *FileWatcher) Start() (err error)
- func (fw *FileWatcher) Stop() (err error)
- type Op
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 ¶
func AddRecursive ¶
AddRecursive add files and all sub-directories under the path to watch
func RemoveRecursive ¶
RemoveRecursive stops watching the directory and all sub-directories.
Types ¶
type FileWatcher ¶
type FileWatcher struct { Delay time.Duration Logger log.Logger // Error logger // contains filtered or unexported fields }
FileWatcher struct for file watching
func Default ¶
func Default() *FileWatcher
Default returns the default FileWatcher instance used by the package-level functions.
func (*FileWatcher) AddRecursive ¶
AddRecursive add files and all sub-directories under the path to watch
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
Click to show internal directories.
Click to hide internal directories.