aheckmann / gridfs-stream

Easily stream files to and from MongoDB
MIT License
615 stars 120 forks source link

.length? #21

Closed clearly closed 11 years ago

clearly commented 11 years ago

Just wondering if there was a way to get the file length after creating the read stream but before calling pipe to another stream. Just wanting to see if it would be possible to set the Content-Length header in an HTTP request without having to do an out-of-band query on the file meta data.

aheckmann commented 11 years ago

by nature of being a stream, we don't know the full length of it. you'd have to buffer it all to determine length.