talira

Notify (Rust)

Cross-platform filesystem notification library for Rust

open sourceCC0-1.0 AND (MIT OR Apache-2.0)free

Notify is a cross-platform Rust library for watching the filesystem for changes. It uses inotify on Linux and Android, FSEvents or kqueue on macOS, ReadDirectoryChangesW on Windows and kqueue on the BSDs and iOS, with polling everywhere as a fallback. The repository also has two debouncers that group bursts of events. alacritty, cargo watch, Deno, mdBook, rust-analyzer, watchexec and Zed use it. It was inspired by Go's fsnotify and Node's Chokidar. It isn't the notify-rust desktop notification crate.

Problems it solves

  • react when a file changes in my Rust program on Linux, macOS and Windows
  • watch a directory for changes in Rust without writing per-OS code
  • collapse a burst of file save events into one rebuild in my Rust tool

Features

  • inotify, FSEvents, kqueue and ReadDirectoryChangesW backends
  • polling backend on every platform
  • mini and full debouncers for bursts of events
  • file-id crate for reading files' unique IDs

Alternatives

The same job

These do what Notify (Rust) does.

  1. walkdir Walk a directory tree recursively in Rust, efficiently and on every platform
  2. tempfile Secure, cross-platform temporary files and directories for Rust

Compare Notify (Rust) with the top 3