⚠️ Deprecated RepositoryThis library is no longer maintained. Development has moved to a new repository: kayibea/linotify
Please update your references and report issues there.
watchdog is a fast and minimal Lua module (written in C) that wraps the Linux inotify API
- Thin native wrapper around
inotify - Callback-based design (no busy loops)
- Object-like instances for multiple watchers
- Fully non-blocking
poll()support - Includes all
inotifyconstants
Via LuaRocks:
luarocks install watchdoglocal signal = require("posix.signal")
local watchdog = require("watchdog")
local running = true
signal.signal(signal.SIGINT, function()
print("\nShutting down...")
running = false
end)
local wd = watchdog.init()
wd:add("/tmp", watchdog.IN_CREATE | watchdog.IN_DELETE, function(ev)
print("Event:", ev.name, ev.mask)
end)
while running do
wd:poll()
end
wd:close()Run tests with Busted:
luarocks testThe test suite will create and remove temporary files in /tmp.
MIT License — do whatever you want.