- From: Shannon Booth <notifications@github.com>
- Date: Sun, 08 Dec 2024 20:10:12 -0800
- To: w3c/FileAPI <FileAPI@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 9 December 2024 04:10:16 UTC
I believe [blog get stream](https://w3c.github.io/FileAPI/#blob-get-stream) algorithm is missing a call to [close](https://streams.spec.whatwg.org/#readablestream-close) that stream, which results in consumers of that readable stream never 'finishing' reading that stream. For example, without a call to "close", from my reading 'done' will never get set to true for the following test: ```js let buffer = new ArrayBuffer(200); let bytesReceived = 0; let offset = 0; let blob = new Blob(['Data to be read! 🦬']); const stream = blob.stream(); const reader = stream.getReader({ mode: "byob" }); while (true) { let result = await reader.read(new type(buffer, offset, buffer.byteLength - offset)); if (result.done) { return; } buffer = result.value.buffer; offset += result.value.byteLength; bytesReceived += result.value.byteLength; } ``` I think the fix should be just adding a close into the blob-get-stream algorithm after all bytes have been queued into the stream. -- Reply to this email directly or view it on GitHub: https://github.com/w3c/FileAPI/issues/206 You are receiving this because you are subscribed to this thread. Message ID: <w3c/FileAPI/issues/206@github.com>
Received on Monday, 9 December 2024 04:10:16 UTC