Skip to content

Latest commit

 

History

History
34 lines (29 loc) · 523 Bytes

README.md

File metadata and controls

34 lines (29 loc) · 523 Bytes

rfsnotify

A wrapper of golang fsnotify that automatically recursively watches directory

Usage

package main

import (
	"log"

	"github.com/dasbd72/rfsnotify"
)

func main() {
    watcher, err := rfsnotify.NewWatcher()
	if err != nil {
		log.Fatal(err)
	}
	err = watcher.Add(root_dir)
	if err != nil {
		log.Fatal(err)
	}

    for {
		select {
		case ev := <-watcher.Events:
			log.Println("event:", ev)
		case err := <-watcher.Errors:
			log.Println("error:", err)
		}
		log.Println(watcher.WatchList())
	}
}