An open API service indexing awesome lists of open source software.

https://github.com/tomnomnom/globwatch

Golang package to watch a glob pattern for changes.
https://github.com/tomnomnom/globwatch

Last synced: 27 days ago
JSON representation

Golang package to watch a glob pattern for changes.

Awesome Lists containing this project

README

        

# globwatch

Golang package to watch a glob pattern for changes.

Example:

```go
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](https://travis-ci.org/tomnomnom/globwatch.svg?branch=master)](https://travis-ci.org/tomnomnom/globwatch)