]> njoseph.me Git - babashka-scripts.git/blobdiff - lib.clj
Replace babashka/curl with httpkit.client
[babashka-scripts.git] / lib.clj
diff --git a/lib.clj b/lib.clj
index 8978c3a2acf466c281022da8d72caaaf16a1bc91..5f216d1980996346936bd57f3017363af3a46c8a 100644 (file)
--- a/lib.clj
+++ b/lib.clj
@@ -2,6 +2,8 @@
 
 (import '[java.nio.file Files FileSystems CopyOption StandardCopyOption])
 
+(require '[org.httpkit.client :as http])
+
 (defn extract-file-from-zip
   [zip-file-name source destination]
   (let [zip-file (io/file zip-file-name)
@@ -18,3 +20,7 @@
   (if (.startsWith s "~")
     (clojure.string/replace-first s "~" (System/getProperty "user.home"))
     s))
+
+(defn download-binary
+  [url destination]
+  (io/copy (:body @(http/get url)) (io/file destination)))