aheckmann/gridfs-stream — pull request #47 by ceari (2014-09-08 11:04:05+00:00)
Title: Let native stream implementation decide if stream can be paused

Bypassing the native stream's pause behaviour can cause it to emit an
'end' event before the last data chunk is emitted. Depending on the
stream consumer, this leads to incomplete files being read from GridFS.
For example, when the stream is piped to an HTTP response, the response
is terminated before the last chunk is sent.

The problem is described in more detail in issue #46 which also contains
a link to a script reproducing the problem. The problematic behaviour
occurs randomly, probably depending on the order the chunks are read
(or partially read) from MongoDB.