Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Compatibility with RethinkDB v1.13+ #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ r.connect( //...
// Make a query to get a cursor
r.table('myTable').run(connection, function(err, cursor) {
var stream = new CursorStream(cursor);
cursor.pipe(//... do whatever you want with your stream !
stream.pipe(//... do whatever you want with your stream !
});
```

Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ function CursorStream(cursor) {
}

CursorStream.prototype._read = function read() {
if (!(this._cursor && this._cursor.hasNext())) {
this.push(null);
return;
}
this._cursor.next(function (err, item) {
if (err) {
if (((err.name === "RqlDriverError") && err.message === "No more rows in the cursor.")) {
this.push(null);
return;
}
this.emit('error', err);
return;
}
if (this.push(item)) {
read.bind(this);
}
}.bind(this));
};
};