m4nuC / async-busboy

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

Fix premature creation of file read streams #16

Closed christensson closed 7 years ago

christensson commented 7 years ago

Read stream now created on the finish event for the write stream to the temp file. The finish event is emitted once the file is completely flushed.

Also, the promise returned from the exported function isn't resolved until all files have been downloaded.

codecov-io commented 7 years ago

Codecov Report

Merging #16 into master will increase coverage by 0.06%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   94.11%   94.18%   +0.06%     
==========================================
  Files           1        1              
  Lines          85       86       +1     
  Branches        6        6              
==========================================
+ Hits           80       81       +1     
  Misses          5        5
Impacted Files Coverage Δ
index.js 94.18% <100%> (+0.06%) :arrow_up:

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 396f333...1d3b74c. Read the comment docs.

christensson commented 7 years ago

Missed PR #14 which does the same thing...

Anyhow, please look at this PR and merge and/or suggest changes. The master branch contains bugs. Try running the tests in this PR a couple of times without the suggested changes in index.js and you'll see what I mean.

christensson commented 7 years ago

Fixes issue #7

dominhhai commented 7 years ago

Same here https://github.com/m4nuC/async-busboy/pull/14

m4nuC commented 7 years ago

Good catch, thanks guys.