https://github.com/pyr/watchman.git
git clone 'https://github.com/pyr/watchman.git'
(ql:quickload :pyr.watchman)
A Clojure library providing a facade for Java's WatchService.
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.Copyright © 2015-2019 Pierre-Yves Ritschard, ISC License