rfsnotify

package module
v0.0.0-...-1625943 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2017 License: MIT Imports: 4 Imported by: 0

README

rfsnotify v0.1.0

recursive directory notifications built as a wrapper around fsnotify (golang)

GoDoc

This is a thin wrapper around https://github.com/go-fsnotify/fsnotify instead of only monitoring a top level folder, it allows you to monitor all folders underneath the folder you specify.

Example:

(error handling omitted to improve readability)

    import "github.com/dietsche/rfsnotify"

//rfsnotify works exactly like fsnotify and implements the same API.
    watcher, err := rfsnotify.NewWatcher()

//rfsnotify adds two new API entry points:
    watcher.AddRecursive("/tmp/")
    watcher.RemoveRecursive("/tmp/")

Documentation

Overview

Package rfsnotify implements recursive folder monitoring by wrapping the excellent fsnotify library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RWatcher

type RWatcher struct {
	Events chan fsnotify.Event
	Errors chan error
	// contains filtered or unexported fields
}

RWatcher wraps fsnotify.Watcher. When fsnotify adds recursive watches, you should be able to switch your code to use fsnotify.Watcher

func NewWatcher

func NewWatcher() (*RWatcher, error)

NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.

func (*RWatcher) Add

func (m *RWatcher) Add(name string) error

Add starts watching the named file or directory (non-recursively).

func (*RWatcher) AddRecursive

func (m *RWatcher) AddRecursive(name string) error

AddRecursive starts watching the named directory and all sub-directories.

func (*RWatcher) Close

func (m *RWatcher) Close() error

Close removes all watches and closes the events channel.

func (*RWatcher) Remove

func (m *RWatcher) Remove(name string) error

Remove stops watching the the named file or directory (non-recursively).

func (*RWatcher) RemoveRecursive

func (m *RWatcher) RemoveRecursive(name string) error

RemoveRecursive stops watching the named directory and all sub-directories.

Jump to

Keyboard shortcuts

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