cryptosense / multipart-form-data

multipart/form-data (RFC2388) parser for OCaml
BSD 2-Clause "Simplified" License
19 stars 6 forks source link

How to tell the size of the file? #15

Closed sgrove closed 5 years ago

sgrove commented 7 years ago

Right now we can get the name of a File via Multipart.file_name, and the body via Multipart.file_stream file - how can I get the number of bytes in the file?

emillon commented 7 years ago

Hi,

Generally speaking, that information is not available at that level. You can have an approximation using the whole request's Content-Length (if present), but for example if there are several files in the request you can't know without consuming the whole file.

Hope that helps!