README
¶
File system notifications for Go
Go 1.3+ required.
Cross platform: Windows, Linux, BSD and OS X.
Adapter | OS | Status |
---|---|---|
inotify | Linux, Android* | Supported |
kqueue | BSD, OS X, iOS* | Supported |
ReadDirectoryChangesW | Windows | Supported |
FSEvents | OS X | Planned |
FEN | Solaris 11 | Planned |
fanotify | Linux 2.6.37+ | |
Polling | All | Maybe |
Plan 9 |
* Android and iOS are untested.
Please see the documentation for usage. Consult the Wiki for the FAQ and further information.
API stability
Two major versions of fsnotify exist.
fsnotify.v0 is API-compatible with howeyc/fsnotify. Bugfixes may be backported, but I recommend upgrading to v1.
import "gopkg.in/fsnotify.v0"
* Refer to the package as fsnotify (without the .v0 suffix).
fsnotify.v1 provides a new API based on this design document. You can import v1 with:
import "gopkg.in/fsnotify.v1"
Further API changes are planned, but a new major revision will be tagged, so you can depend on the v1 API.
master may have untagged changes. Use it to test the very latest code, but don't expect it to remain API-compatible:
import "github.com/go-fsnotify/fsnotify"
Contributing
- Send questions to golang-dev@googlegroups.com.
- Request features and report bugs using the GitHub Issue Tracker. Please indicate the platform you are running on.
fsnotify is derived from code in the golang.org/x/exp package and it may be included in the standard library in the future. Therefore fsnotify carries the same LICENSE as Go. Contributors retain their copyright, so you need to fill out a short form before we can accept your contribution: Google Individual Contributor License Agreement.
Please read CONTRIBUTING before opening a pull request.
Example
See example_test.go.
Documentation
¶
Overview ¶
Package fsnotify provides a platform-independent interface for file system notifications.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Name string // Relative path to the file or directory. Op Op // File operation that triggered the event. }
Event represents a single file system notification.
type Watcher ¶
type Watcher struct { Events chan Event Errors chan error // contains filtered or unexported fields }
Watcher watches a set of files, delivering events to a channel.
func NewWatcher ¶
NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
Example ¶
Output: