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 <http://clojure.java.io/copy|clojure.java.io/copy>
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.