Próbuję zapisać plik pobrany za pomocą clj-httpZapisywanie formie obrazu wniosek CLJ-http do pliku
Mam następujący kod:
(def test-file
(cl/get "http://placehold.it/350x150"))
(defn write-file []
(with-open [w (clojure.java.io/writer "test-file.gif" :append true)]
(.write w (:body test-file))))
a kiedy starają się ją jako bajt -array, otrzymuję wyjątek:
user=> (def test-file
(cl/get "http://placehold.it/350x150" {:as :byte-array}))
#'user/test-file
user=> (write-file)
IllegalArgumentException No matching method found: write for class java.io.BufferedWriter clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:79)
Pomoc!
Chociaż można użyć CLJ-http , można to zrobić wyłącznie za pomocą c lojure.java.io: http://stackoverflow.com/q/15628682/425313 –