mongodb/node-mongodb-native — pull request #607 by tedeh (2012-05-15 12:26:59+00:00)
Title: Fix gridfs readstream

I am submitting three things to accepted into master:

1. Some tiny typos corrected in docs/gridfs.md
2. A modified test case for the GridFS ReadStream class that makes it fail because the stream returned by `GridStore.prototype.stream` was paused with `ReadStream.prototype.pause` immediately on creation. This makes `ReadStream.prototype.resume` not function correctly (resume will only work if at least one chunk has been emitted already) and this failing test case indicates that.
3. A fix to `ReadStream.prototype.resume` to make the test pass. I did this by removing logic to check if there is a `stream.pendingChunk` or not (a similar check is already being done in `ReadStream.prototype._execute`) and resume will pass directly to that method instead. Also, `ReadStream.prototype.resume` should not emit `close` every time that it is called - I've reviewed the node source and `close` should indeed be the final event in a stream, emitted only _once_.