fswatch

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2018 License: MIT Imports: 6 Imported by: 2

README

fswatch

This is a small Go library that builds on top of github.com/fsnotify/fsnotify to add some features that I almost always want when using this library:

  • Recursive directory watches (and watch removals -- see https://github.com/fsnotify/fsnotify/issues/41).
  • Ignore CHMOD-only changes; this works around a macOS issue that Spotlight likes to touch files again immediately after they've been touched (and I normally don't care about attribute changes; only additions and deletions).
  • Coalesce rapid sequences of changes over a configurable threshold: this helps in various scenarios, such as editors writing out via temp files.

Warning

This is a library I wrote purely for my own needs and I'm pretty sure it has some bugs. Or maybe fsnotify has some bugs. The whole file system notification thing has all kinds of fun flakiness, in my experience.

Documentation

Overview

fswatch is a small Go library that builds on top of github.com/fsnotify/fsnotify and adds a few commonly-needed extra features, including recursive watches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Watch added in v0.0.2

func Watch(dir string, coalesceInterval time.Duration, ignore ...string) (events chan []string, errs chan error, err error)

Watch creates a recursive file watch for dir.

It returns two channels; they have meanings similar to fsnotify.Watcher, except that the events channel returns slices of modified files/directories).

The watcher coalesces quick sequences of events into a single event slice, using a time window specified by coalesceInterval.

The ignore list is a list of directories (relative to dir) to ignore.

Types

This section is empty.

Directories

Path Synopsis
cmd
watch
watch is a tiny command-line driver that exercises github.com/cespare/fswatch.
watch is a tiny command-line driver that exercises github.com/cespare/fswatch.

Jump to

Keyboard shortcuts

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