Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.

README.mkd

globwatch

Golang package to watch a glob pattern for changes.

Example:

package main

import (
    "fmt"
    "github.com/tomnomnom/globwatch"
)

func main() {
    // Watch returns a channel of events and a control channel to stop the watching
    // func Watch(pattern string, sleepInMs int) (<-chan Event, chan<- bool)
    evs, _ := globwatch.Watch("*.log", 100)

    for ev := range evs {
        switch ev.Type() {
        case globwatch.Added:
        fmt.Printf("Added: %s\n", ev.Filename())
        case globwatch.Deleted:
        fmt.Printf("Deleted: %s\n", ev.Filename())
        case globwatch.Truncated:
        fmt.Printf("Truncated: %s\n", ev.Filename())
        }
    }
}

Build Status

About

Golang package to watch a glob pattern for changes.

Resources

Releases

No releases published

Packages

No packages published