fs

package
v0.0.0-...-7429fd7 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2015 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Package fs implements a recursive file system watcher. This code is based on code from https://github.com/gophertown/looper/blob/master/watch.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	*fsnotify.FileEvent
}

Event is a structure that wraps the fsnotify.FileEvent. The reason we don't expose fsnotify.FileEvent directly is to allow for future expansion of state information in the Event struct.

type RecursiveWatcher

type RecursiveWatcher struct {
	*fsnotify.Watcher            // File system watcher
	Events            chan Event // The channel to send events on
	ErrorEvents       chan error
}

RecursiveWatcher represents the file system watcher and communication channels.

func NewRecursiveWatcher

func NewRecursiveWatcher(path string) (*RecursiveWatcher, error)

NewRecursiveWatcher creates a new file system watcher for path. It walks the directory tree at path adding each directory to the watcher. When the user creates a new directory it is also added to the list of directories to watch.

func (*RecursiveWatcher) Start

func (watcher *RecursiveWatcher) Start()

Start starts monitoring for file system events and sends the events on the Events channel. It also handles directory create events by adding the newly created directory to the list of directories to monitor.

Jump to

Keyboard shortcuts

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