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.
- Host: GitHub
- URL: https://github.com/tomnomnom/globwatch
- Owner: tomnomnom
- Created: 2014-05-11T12:11:20.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2016-03-28T19:17:47.000Z (about 9 years ago)
- Last Synced: 2025-04-11T04:13:00.757Z (27 days ago)
- Language: Go
- Size: 6.84 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkd
Awesome Lists containing this project
README
# globwatch
Golang package to watch a glob pattern for changes.
Example:
```go
package mainimport (
"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())
}
}
}
```[](https://travis-ci.org/tomnomnom/globwatch)