fsmonitor

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

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

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

fsmonitor

detect file's modification and execute callback function when file modified

useage:

go get github.com:subing/fsmonitor.git

func echo() error {
	fmt.Println("echo")
	return nil
}

func maxPrint() error {
	fmt.Println("max.txt modifyed")
	return nil
}
func TestWatch(t *testing.T) {
	AddWatch("./", "hello.txt", echo)
	AddWatch("./", "max.txt", maxPrint)
	Start()
	stop()
}

func stop() {
	time.Sleep(time.Second * 10)
	Stop()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWatch

func AddWatch(path, file string, ops Func)

func AddWatchPath

func AddWatchPath(path string, ops Func)

func DeleteWatch

func DeleteWatch(path, file string)

func Start

func Start() error

func Stop

func Stop()

Types

type FsMonitor

type FsMonitor struct {
	// contains filtered or unexported fields
}

type Func

type Func func() error

Jump to

Keyboard shortcuts

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