X-Git-Url: https://njoseph.me/gitweb/babashka-scripts.git/blobdiff_plain/0b0f2aa39a06e77b1517f895a2c82946f684b568..59cefd6c8175f2f1473420130eeb44cacb1df661:/lib.clj diff --git a/lib.clj b/lib.clj index 8978c3a..70fef53 100644 --- a/lib.clj +++ b/lib.clj @@ -2,6 +2,15 @@ (import '[java.nio.file Files FileSystems CopyOption StandardCopyOption]) +(require '[babashka.process :as p] '[org.httpkit.client :as http]) + +(defn run-cmd + [command] + (->> command + p/process + :out + slurp)) + (defn extract-file-from-zip [zip-file-name source destination] (let [zip-file (io/file zip-file-name) @@ -18,3 +27,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)))