This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-10
Channels
- # announcements (4)
- # beginners (116)
- # boot (4)
- # calva (63)
- # cider (8)
- # clara (20)
- # cljdoc (10)
- # cljsrn (69)
- # clojure (115)
- # clojure-austin (1)
- # clojure-dev (4)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-nl (6)
- # clojure-russia (10)
- # clojure-uk (84)
- # clojurescript (28)
- # cursive (14)
- # data-science (1)
- # datascript (1)
- # datomic (11)
- # duct (3)
- # emacs (13)
- # figwheel-main (11)
- # fulcro (4)
- # graphql (6)
- # jackdaw (2)
- # jobs (23)
- # jobs-rus (1)
- # kaocha (11)
- # lein-figwheel (13)
- # leiningen (55)
- # luminus (14)
- # lumo (22)
- # off-topic (121)
- # pathom (19)
- # re-frame (6)
- # reagent (3)
- # reitit (22)
- # remote-jobs (10)
- # ring-swagger (1)
- # shadow-cljs (67)
- # slack-help (5)
- # spacemacs (1)
- # sql (18)
- # vim (28)
- # yada (2)
I'm having a hard time finding how to upload a file (`multipart/form-data`) with yada. Do some of you know a good example/documentation about it?
Found a way. I had to implement a coercion-matcher
function coercing a yada.multipart.DefaultPart
to a java.io.File
. I extended the yada.multipart/default-part-coercion-matcher
to add {java.io.File my-coercing-fn}
, this coercing function take the part, transform the :bytes
byte array to a ByteArrayInputStream
, skip n
bytes (where n
is the part's :body-offset
) and then use
to copy the stream content to a file in /tmp/
. So of course for large files it could be problematic in term of memory consumption and disk space, but this fit my use case ATM.