使用clojure实现能通过HTTP GET请求,来下载文件,求指点
clojure实现下载文件,求指点
hellojukay
#3
(def test-file
(client/get "http://placehold.it/350x150" {:as :byte-array}))
(defn write-file []
(with-open [w (java.io.BufferedOutputStream. (java.io.FileOutputStream. "test-file.gif"))]
(.write w (:body test-file))))
BlackRain
#4
(slurp “http://helloworld.file…”)
如果你是服务端, 提供文件下载服务的
参看这个
http://ring-clojure.github.io/ring/ring.util.response.html#var-file-response
(ring.util.response/file-response filepath)
就可以了