Liking cljdoc? Tell your friends :D


Yet another filesystem watcher for Clojure. This one uses Clojure-Watch (a filesystem watcher that uses Java 7's WatchEvent API) + Clojure.core.async's channel abstraction for CPU efficiency and a dead-simple API.


[async-watch "0.1.1"]


The changes-in function takes a single path or a collection of paths:

(require '[async-watch.core :refer [changes-in cancel-changes]])

(let [changes (changes-in ["src" "resources"])]
  (go (while true
        (let [[op filename] (<! changes)]
          ;; op will be one of :create, :modify or :delete
          (println filename "just experienced a" op)))))

Internally, each changes channel is fed by a running Clojure-Watch in a separate future. To cancel these futures, run (cancel-changes).


lein test


Copyright © 2014 Murphy McMahon

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close