Note file caching in the readme
alecmev opened this issue · 1 comments
I understand that file caching is inevitable in a promise-based form parser, since to be able to have an overview of the whole form in one go you also need to, well, read and process the whole body in one go. This is obvious if you stop and think about it for a second, but, being in a rush to just get stuff done, this has escaped my attention, until a slightly later "duh" moment. A quick note, warning people about the difference in nature between async-busboy
and co-busboy
/ busboy
, somewhere high up in the readme, could save some time for somebody else in a hurry.
Just in case, this matters, because if you're interested in doing any processing/spying on a file (e.g. checking its magic bytes or calculating a hash), piping it through your transforms while it's downloading is more performant than saving it on the disk and then reading from there.
There is a note in the readme that says:
As of today there is no support for directly piping of the request stream into a consumer. The files are first written to disk using os.tmpDir().
I will push that up to the top on next push.
Also, I understand your use case and I was planning to address it. We could easily pass a preprocessor as an option. If you'd like to take a go at it please go ahead.