m4nuC / async-busboy

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

Is there a way to expose uploading progress? #23

Closed bangonkali closed 7 years ago

bangonkali commented 7 years ago

Hi i just tried out this tool. It's awesome. Is there a way or an example you can give for tracking the uploading progress? Is this something that can be done on the client side right away or do i have to implement some sort of custom logic on the server?

karladler commented 7 years ago

It's possible to handle that in HTML5 File upload API on client side.

m4nuC commented 7 years ago

@bangonkali Apologies for the delay. As @abimelex mentioned this is something to be handled on the client side. If you haven't already solved this, have a look at the API doc: https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications

nhtua commented 6 years ago

@m4nuC I think showing the uploading progress is based-on both client and server side. Because xhr.upload.addEventListener("progress", function(e){/**/}) only fire until the server responses any first bytes. So, If you do nothing before asyncBusboy.onFile run, then the client continues to wait to show up 100% only once at the end.

I have tried to pipe some '\n' into server response and the client was starting to fire regularly progress but the output stream format changed also.