Hacker News new | ask | show | jobs
by chatmasta 2 days ago
Building @parcel/watcher was always a huge PITA. I also hope they release this package separately because it’d be nice to have an easy to install, on any OS, file watcher that doesn’t require C++ toolchain.
1 comments

Thing is file watching is not in a great place on linux w.r.t inotify and fanotify. In all my usecases present and past, I either just did a full scan each time (btw, this can be done extremely fast even on an entire homedir @ >4M entries/s)

Or recently I use an eBPF-based file watcher. This needs the client to run a transient process with cap_perfmon and cap_bpf that sets up the ring buffers and exits. After that, any unpriveleged process can read from that ring buffer at any time and it just works.

inotify works just fine for stuff like project watchdirs, but I wanted one for a whole home directory where it had lots of issues, fd limits, race conditions in situations like mkdir -p a/b, and renames/mv being hard to deal with, etc.