watcher

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFolderPathNotFound = errors.New("could not find a folder path for watcher")
)

Functions

func New

func New(configs ...Option) (*folderWatcher, error)

New creates an new instance of folder watcher

Types

type EventHandler

type EventHandler interface {
	OnCreate(ctx context.Context, path string, fileInfo os.FileInfo)
	OnRemove(ctx context.Context, path string, fileInfo os.FileInfo)
	OnWrite(ctx context.Context, path string, fileInfo os.FileInfo)
	OnRename(ctx context.Context, path string, fileInfo os.FileInfo, oldPath string)
	OnMove(ctx context.Context, path string, fileInfo os.FileInfo, oldPath string)
}

EventHandler

type FolderWatcher

type FolderWatcher interface {
	RegisterHandler(handler EventHandler)
	AddFile(path string) error
	Watch(ctx context.Context) error
	Close()
}

type Option

type Option func(option *watcherOptions)

Option configuration for the FileWatcher Use exported Option factory functions

func WithPaths

func WithPaths(path ...string) Option

WithPaths configures the list of paths the file watcher would be watching recursively. For best results do not include two paths withing the same directory

Jump to

Keyboard shortcuts

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