Fork me on GitHub
Geoffrey Gaillard18:04:28

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 Gaillard11:04:34

Found a way. I had to implement a coercion-matcher function coercing a yada.multipart.DefaultPart to a I extended the yada.multipart/default-part-coercion-matcher to add { 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.