yada

Geoffrey Gaillard 2019-04-10T18:01:28.009500Z

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?

Geoffrey Gaillard 2019-04-11T11:53:34.009700Z

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.