Skip to content

Commit

Permalink
LimitReader: check if _unread() exists before calling to make limitre…
Browse files Browse the repository at this point in the history
…ader more flexible, work with any async iterator

bump to 1.4.2
  • Loading branch information
ikreymer committed Mar 3, 2021
1 parent 57ea3b0 commit 34b8383
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion dist/warcio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3676,7 +3676,9 @@ class LimitReader extends BaseAsyncIterReader
const [first, remainder] = LimitReader.splitChunk(chunk, this.limit);
chunk = first;

this.sourceIter._unread(remainder);
if (this.sourceIter._unread) {
this.sourceIter._unread(remainder);
}
}

if (chunk.length) {
Expand Down
2 changes: 1 addition & 1 deletion dist/warcio.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "warcio",
"version": "1.4.1",
"version": "1.4.2",
"main": "index.js",
"module": "main.js",
"license": "Apache-2.0",
Expand Down
4 changes: 3 additions & 1 deletion src/readers.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ class LimitReader extends BaseAsyncIterReader
const [first, remainder] = LimitReader.splitChunk(chunk, this.limit);
chunk = first;

this.sourceIter._unread(remainder);
if (this.sourceIter._unread) {
this.sourceIter._unread(remainder);
}
}

if (chunk.length) {
Expand Down

0 comments on commit 34b8383

Please sign in to comment.