cozy/cozy-data-system — pull request #88 by frankrousseau (2014-07-16 16:04:36+00:00)
Title: Handle file upload via streams instead of saving file on the disk (Attachments and Binaries)

Hi,

I upgraded the americano and Express versions. Express 4 requires some changes I performed here (some common middlewares are required separately).
I took that opportunity to handle file uploads via streams instead of saving them on the disk. I can't figure out why but in the second case the file was completely loaded in memory. To achieve that I have used the multiparty library. The code is not easy to read because to keep things in streams we should read the multipart form in a very raw way. I put a lot of comments to make things easier.

NB: One binary test is broken but I don't understand why (it's about revision). Does someone understand why?
https://github.com/cozy/cozy-data-system/blob/master/tests/binary_tests.coffee#L56-L63