Clojure China

clojure实现下载文件,求指点

#1

使用clojure实现能通过HTTP GET请求,来下载文件,求指点

#2

https://gist.github.com/philippkueng/11377226

#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))))
#4

(slurp “http://helloworld.file…”)

如果你是服务端, 提供文件下载服务的

参看这个
http://ring-clojure.github.io/ring/ring.util.response.html#var-file-response

(ring.util.response/file-response filepath)

就可以了

#5

参考这个:
https://cloud.tencent.com/developer/doc/1037

#6

非常感谢,就是服务端用的