fsnotify

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fsnotify implements filesystem notification,.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultIsIgnorePath

func DefaultIsIgnorePath(path string) bool

Types

type FileEvent

type FileEvent struct {
	*originFsnotify.FileEvent
	Name string
	Time time.Time
}

it is a wrapper of github.com/howeyc/fsnotify.FileEvent

type Runner

type Runner struct {
	*Watcher
	//wait WaitTime to run your function (default 0.2s)
	WaitTime time.Duration
	//whether init run this function (default true)
	InitRun bool
}

watch and run a function you should handle error in Watcher and add some files to watch (at least)

func NewRunner

func NewRunner(bufferSize int) (*Runner, error)

func (*Runner) Run

func (runner *Runner) Run(work func())

this function will block forever

type Watcher

type Watcher struct {
	*originFsnotify.Watcher
	Event chan *FileEvent
	Error chan error
	//default ignore all file start with "."
	IsIgnorePath func(path string) bool
	//default is nil,if is nil ,error send through Error chan,if is not nil,error handle by this func
	ErrorHandler func(err error)
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(bufferSize int) (watcher *Watcher, err error)

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) GetErrorChan

func (w *Watcher) GetErrorChan() chan error

func (*Watcher) GetEventChan

func (w *Watcher) GetEventChan() chan *FileEvent

func (*Watcher) WatchRecursion

func (w *Watcher) WatchRecursion(path string) error

Jump to

Keyboard shortcuts

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