filemon

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

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

Go to latest
Published: Nov 14, 2017 License: MIT Imports: 7 Imported by: 2

README

Build Status GoDoc

###Example:

// create a new watcher
w := filemon.NewWatcher(func(ev *filemon.WatchEvent) {
    fmt.Println(ev)
})

// watch the current path
w.Watch("./")

// wait for a ctrl+c
w.WaitForKill()

###Structs

type WatchEvent struct {
    Fpath string
    Type  EvType
}

type EvType int
const (
    C_Create EvType = iota
    C_Modify
    C_Delete
    C_Rename
    C_Attrib
)

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvType

type EvType int
const (
	C_Create EvType = iota
	C_Modify
	C_Delete
	C_Rename
	C_Attrib
)

type OnFileEvCb

type OnFileEvCb func(*WatchEvent)

type WatchEvent

type WatchEvent struct {
	Fpath string
	Type  EvType
}

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}
Example
package main

import (
	"fmt"
	"github.com/noypi/filemon"
)

func main() {

	// create a new watcher
	w := filemon.NewWatcher(func(ev *filemon.WatchEvent) {
		fmt.Println(ev)
	})

	// watch the current path
	w.Watch("./")

	// wait for a ctrl+c
	w.WaitForKill()

}
Output:

func NewWatcher

func NewWatcher(cb OnFileEvCb) *Watcher

func (*Watcher) Close

func (this *Watcher) Close()

func (*Watcher) RemoveWatch

func (this *Watcher) RemoveWatch(fpath string)

func (Watcher) WaitForKill

func (this Watcher) WaitForKill()

func (*Watcher) Watch

func (this *Watcher) Watch(fpath string)

See Watch Example.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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