Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup! fix structured cloning wpt and add comments
  • Loading branch information
debadree25 committed Sep 19, 2023
commit 23cf23ff6f010af64edbeb6bb5aa7949fa256b48
6 changes: 5 additions & 1 deletion lib/internal/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ class Blob {
if (status === 0) {
// EOS
c.close();
// this is to signal the end for byob readers
// see https://streams.spec.whatwg.org/#example-rbs-pull
c.byobRequest?.respond(0);
const pending = this.pendingPulls.shift();
pending.resolve();
Expand All @@ -354,7 +356,9 @@ class Blob {
pending.reject(error);
return;
}
if (buffer !== undefined) {
// ReadableByteStreamController.enqueue errors if we submit a 0-length
// buffer. We need to check for that here.
if (buffer !== undefined && buffer.byteLength !== 0) {
c.enqueue(new Uint8Array(buffer));
}
// We keep reading until we either reach EOS, some error, or we
Expand Down