https://github.com/dunglas/go-fswatch
Go bindings for libfswatch
https://github.com/dunglas/go-fswatch
cgo-bindings change-monitor event-notifications fswatch golang inotify kqueue
Last synced: about 1 month ago
JSON representation
Go bindings for libfswatch
- Host: GitHub
- URL: https://github.com/dunglas/go-fswatch
- Owner: dunglas
- License: bsd-3-clause
- Created: 2024-08-13T11:57:55.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-20T15:58:04.000Z (10 months ago)
- Last Synced: 2025-04-30T23:48:20.170Z (about 1 month ago)
- Topics: cgo-bindings, change-monitor, event-notifications, fswatch, golang, inotify, kqueue
- Language: Go
- Homepage: https://dunglas.dev
- Size: 16.6 KB
- Stars: 26
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-fswatch: Go bindings for `libfswatch`
[](https://pkg.go.dev/github.com/dunglas/go-fswatch)
[Go](https://go.dev) bindings for [`libfswatch`](https://github.com/emcrisostomo/fswatch/blob/master/README.libfswatch.md).
`libfswatch` provides comprehensive, cross-platform file change monitoring capabilities.
## Features
go-fswatch exposes all features provided by `fswatch` and `libfswatch` through an idiomatic Go API:
* cross-platform: inotify (Linux), FSEvents (macOS), Windows, kqueue (*BSD), File Events Notification (Solaris) and polling
* watch files and directories
* recursive watching
* file and directory filtering (using regular expressions)
* events filtering## Install
First, install `libfswatch`:
1. [Download the latest release (`fswatch-.tar.gz`)](https://github.com/emcrisostomo/fswatch/releases)
2. Compile and install `libfswatch`:```console
tar xzf fswatch-*.tar.gz
cd fswatch-*
./configure
make
sudo make install
```Then, you can use this Go module as usual:
```console
go get github.com/dunglas/go-fswatch
```## Usage and Examples
See [the documentation](https://pkg.go.dev/github.com/dunglas/go-fswatch).
## Cgo
This package depends on [cgo](https://go.dev/blog/cgo).
If you are looking for non-cgo alternatives, see:* [fsnotify](https://github.com/fsnotify/fsnotify) (doesn't support FSEvents nor polling)
* [notify](https://github.com/rjeczalik/notify) (doesn't support include/exclude filters)## Credits
Created by [Kévin Dunglas](https://dunglas.dev) and sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).