busboy icon indicating copy to clipboard operation
busboy copied to clipboard

How can we know the size of the file uploded in busboy? I want to know the exact size of the file

Open Maleeha456 opened this issue 3 years ago • 1 comments

Maleeha456 avatar Sep 14 '22 07:09 Maleeha456

That's up to you to keep track of. busboy just provides the file streams.

mscdex avatar Sep 14 '22 11:09 mscdex

It looks like lib/types/multipart.js calculates the file size already to check fileSizeLimit. Would you guys consider implementing/accepting a PR for that size to be emitted as a property on the FileInfo that already gets returned for bb.on('file'...)?

gazebosx3 avatar Nov 08 '22 20:11 gazebosx3

@gazebosx3 That’s not possible in general. fileSizeLimit is checked as the stream for the file is read, i.e. after the file event is emitted.

charmander avatar Nov 09 '22 01:11 charmander

@gazebosx3 As @charmander said, that's not possible. You will need to count the bytes yourself as the file streams in if you need the total size when the stream ends.

mscdex avatar Nov 09 '22 04:11 mscdex