File system watching backed by Apero.File.Watcher and Arrea.WorkerSupervisor.
These operations were moved from Apero.File (v2.x) to Trebejo.File (v1.x)
because they depend on Arrea.WorkerSupervisor for process supervision.
The pure file operations remain in Apero.File with no Arrea dependency.
Example
iex> {:ok, _pid} = Trebejo.File.watch(["/tmp"], fn events ->
...> IO.inspect(events, label: "changed")
...> end, debounce_ms: 50)
Summary
Functions
@spec unwatch(pid()) :: :ok
Stops a file watcher by PID.
@spec watch([binary()], ([{binary(), [atom()]}] -> any()), keyword()) :: {:ok, pid()} | {:error, term()}
Starts watching dirs for file system changes.
Calls callback with a list of {path, events} tuples after each
debounce window.
Options
:debounce_ms— debounce delay in ms (default:100):name— optional name for the watcher process
Returns {:ok, pid}.