fswatcher

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: LGPL-3.0 Imports: 5 Imported by: 3

README

fswatcher

A handy wrapper around fsnotify with deduplication

watcher := fswatcher.New([]string{"/tmp/your-file.txt"}, 0)
defer watcher.Stop()
go watcher.Start(func(e fsnotify.Event){
	// do something with event
})

Documentation

Index

Constants

View Source
const DefaultDelay = 100 * time.Millisecond

DefaultDelay to avoid unnecessary handler calls

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

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

Watcher of file system changes

func New

func New(files []string, delay time.Duration) (*Watcher, error)

Creates FS Watcher

func (*Watcher) Start

func (w *Watcher) Start(handler func(e fsnotify.Event))

Start watcher

func (*Watcher) Stop

func (w *Watcher) Stop() error

Stop watcher

Jump to

Keyboard shortcuts

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