emcrisostomo /fswatch
A cross-platform file change monitor with multiple backends: Apple macOS File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify and fanotify, Microsoft Windows and a stat()-based backend.
★ 5,616⑂ 348👁 94⑃ 102● 291▤ 59
+1
日增长
5,616
stars
348
forks
94
watchers
102
prs
291
issues
59
releases
README
README
======
fswatch is a file change monitor that receives notifications when the contents
of the specified files or directories are modified. fswatch implements
several monitors:
A monitor based on the _File System Events API_ of Apple macOS.
A monitor based on _kqueue_, a notification interface introduced in FreeBSD
4.1 (and supported on most BSD systems, including macOS).
A monitor based on the _File Events Notification_ API of the Solaris kernel
and its derivatives.
A monitor based on _inotify_, a Linux kernel subsystem that reports file
system changes to applications.
A monitor based on _fanotify_, a Linux kernel subsystem that reports file
system events to applications.
A monitor based on _ReadDirectoryChangesW_, a Microsoft Windows API that
reports changes to a directory.
A monitor which periodically stats the file system, saves file modification
times in memory, and manually calculates file system changes (which works
anywhere stat (2) can be used).
fswatch should build and work correctly on any system shipping either of the
aforementioned APIs.
Table of Contents
-----------------
libfswatch
Features
Limitations
Getting fswatch
Building from Source
Installation
Documentation
Localization
Usage
Contributing
Bug Reports
libfswatch
----------
fswatch is a frontend of libfswatch, a library with C, C++ and
[Go][go.binding] bindings. More information on libfswatch can be found
[here][README.libfswatch.md].
[go.binding]: https://github.com/dunglas/go-fswatch
[README.libfswatch.md]: README.libfswatch.md
Features
--------
fswatch main features are:
Support for many OS-specific APIs such as kevent, inotify, and FSEvents.
Recursive directory monitoring.
Path filtering using including and excluding regular expressions, with
legacy and conjunctive evaluation modes.
Customizable record format.
Support for periodic idle events.
Limitations
-----------
The limitations of fswatch depend largely on the monitor being used:
The FSEvents monitor, available only on macOS, has no known limitations,
and scales very well with the number of files being observed.
The File Events Notification monitor, available on Solaris kernels and
its derivatives, has no known limitations.
The kqueue monitor, available on any \BSD system featuring kqueue,
requires a file descriptor to be opened for every file being watched. As a
result, this monitor scales badly with the number of files being observed,
and may begin to misbehave as soon as the fswatch process runs out of file
descriptors. In this case, fswatch dumps one error on standard error for
every file that cannot be opened.
The inotify monitor, available on Linux since kernel 2.6.13, may suffer
from several limitations. It provides no information about the user or
process that triggered an event, so it cannot easily distinguish events it
triggers iTop issues
#177dual license?24 comments · 2017-09-30#121realpath on mingw-w6415 comments · 2016-06-14#134fswatch reports files/directories that are being read (Linux/Ubuntu/inotify_monitor)12 comments · 2016-09-15#169Distributable versions for package managers and language bindings7 comments · 2017-05-13#212Other possible events?6 comments · 2018-09-07#197On macOS, "touch -a" incorrectly causes a file to show up as modified6 comments · 2018-01-06#252Out of date list of monitors at wiki page or obsolete/removed monitors for Solaris and Windows?5 comments · 2020-08-15#229Add fanotify support5 comments · 2019-05-14
Latest release
fswatch v. 1.22.0 1.22.0 2026-07-22What's New in fswatch v. 1.22.0:
fswatch v. 1.22.0 introduces the following features and bug fixes:
The release workflow now provides an experimental static Linux x86_64
archive.
Bug fix, PR 388, Issue 387: On Linux, inotify MovedFrom and MovedTo events
now report the complete child path for one-sided moves and paired renames,
while preserving the kernel rename-correlation cookie.
libfswatch v. 1.22.0 introduces the following features and bug fixes:
Bug fix, PR 388, Issue 387: The inotify monitor now appends the
kernel-provided child name to MovedFrom and MovedTo