add file-exists? fn

This commit is contained in:
Gered 2013-05-23 00:04:55 -04:00
parent 75ac524736
commit 03058f574f

View file

@ -5,6 +5,11 @@
(:require [com.ashafa.clutch :as couch]
[clojure.java.io :as io]))
(defn file-exists? [file]
(let [f (ensure-prefix file "/")]
(couch/with-db files
(not (zero? (count (couch/get-view "files" "listPublished" {:key f})))))))
(defn get-file [file]
(let [f (ensure-prefix file "/")]
(couch/with-db files