Skip to content

romanoff/fsmonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Fsmonit

Simple wrapper around fsnotify to monitor changes in files and folders (including subdirectories created after monitoring has started).

Example:

package main

import (
	"github.com/romanoff/fsmonitor"
	"fmt"
	"log"
	)
func main() {
	watcher, err := fsmonitor.NewWatcher()
	if err != nil {
		log.Fatal(err)
	}
	err = watcher.Watch("/tmp/foo")
	if err != nil {
		log.Fatal(err)
	}
	for {
		select {
		case ev := <-watcher.Event:
			fmt.Println("event:", ev)
		case err := <-watcher.Error:
			fmt.Println("error:", err)
		}
	}
}

There is also an option to skip certain folders (like .git for example):

	watcher, err := fsmonitor.NewWatcherWithSkipFolders([]string{".git"})

Releases

No releases published

Packages

No packages published

Languages