watchman: the hero your filesystem needs
A Clojure library providing a facade for Java's WatchService.
Usage
Pull the depenency with leiningen (add this in your project.clj
)
[spootnik/watchman "0.3.7"]
(watch.man/watch!
"/some/dir"
(fn [event] (println (pr-str event))))
watch!
accepts an optional map argument with the following keys:
event-types
: a collection of any keywords from:create
,:modify
,:delete
watch!
returns the underlying WatchService
, watch.man/close
can
be called on the service.
Each argument to the callback when using watch!
will be a map with
the following keys:
type
::path
,:exception
or:closing
path
: The path a:path
event happens ontypes
: The types of event a:path
event was triggered forsrv
: The watch serviceexception
: The exception that was raised for:exception
events.
Changelog
0.3.8
- Readme improvements by @blak3mill3r
License
Copyright © 2015-2019 Pierre-Yves Ritschard, ISC License