m4nuC / async-busboy

Promise based multipart form parser for KoaJS
MIT License
167 stars 58 forks source link

Add onFile option to add handler to directly handle files #18

Closed christensson closed 7 years ago

christensson commented 7 years ago

When using a custom onFile handler, the promise returned by async-busboy only resolves to an object containing fields. The advantage is that no intermediate temp files needs to be stored on disk!

The changes is backward-compatible with the previous API and adds a new API in order to get rid of the need to store temp files.

Basically, if you need performance and/or disk-space is scarce, use new API. If you want simplicity, use old API.

See updated README.md or testcase for example...

What do you think? Discuss!

codecov-io commented 7 years ago

Codecov Report

Merging #18 into master will decrease coverage by 0.63%. The diff coverage is 90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #18      +/-   ##
==========================================
- Coverage   94.18%   93.54%   -0.64%     
==========================================
  Files           1        1              
  Lines          86       93       +7     
  Branches        6        9       +3     
==========================================
+ Hits           81       87       +6     
- Misses          5        6       +1
Impacted Files Coverage Δ
index.js 93.54% <90%> (-0.64%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 11b672d...0dcbb44. Read the comment docs.