Skip to content

Commit

Permalink
lib: fix lib/internal/blob.js Blob.stream() for nodejs#48668 nodejs#4…
Browse files Browse the repository at this point in the history
…8916

Add lacked calling resolve() for finish ReadableStream source.pull().

Fixes: nodejs#48668
Fixes: nodejs#48916
Fixes: nodejs#48232
Refs: 8cc1438
  • Loading branch information
bellbind committed Jul 26, 2023
1 parent e8dcf79 commit b7d9941
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/internal/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class Blob {
if (c.desiredSize <= 0) {
// A manual backpressure check.
if (this.pendingPulls.length !== 0) {
// case of waiting pull finished (= not yet canceled)
// A case of waiting pull finished (= not yet canceled)
const pending = this.pendingPulls.shift();
pending.resolve();
}
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,16 @@ assert.throws(() => new Blob({}), {
})().then(common.mustCall());

(async () => {
const b = new Blob(["A", "B", "C"]);
const b = new Blob(['A', 'B', 'C']);
const stream = b.stream();
const chunks = [];
const decoder = new TextDecoder();
await stream.pipeTo(new WritableStream({
write(chunk) {
chunks.push(decoder.decode(chunk, {stream: true}));
chunks.push(decoder.decode(chunk, { stream: true }));
}
}));
assert.strictEqual(chunks.join(""), "ABC");
assert.strictEqual(chunks.join(''), 'ABC');
})().then(common.mustCall());

(async () => {
Expand Down

0 comments on commit b7d9941

Please sign in to comment.