- From: Mattias Buelens <notifications@github.com>
- Date: Mon, 06 Aug 2018 09:05:06 -0700
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 6 August 2018 16:06:14 UTC
@ricea I think I prefer the updated semantics.
I can't really think of a use case where you'd be interested in empty chunks/strings. I feel like it'd just make user code unnecessarily more complicated, e.g.:
```js
stream
.pipeThrough(new TextDecoderStream())
.pipeThrough(new TransformStream({
transform(chunk, controller) {
if (chunk.byteLength === 0) {
return; // what else would you do here?
}
// do stuff
}
}));
```
I'm not aware of any spec that enqueues empty chunks to a stream. [Fetch doesn't do it](https://fetch.spec.whatwg.org/#ref-for-concept-enqueue-readablestream%E2%91%A0):
> 12.1.1.1. **If one or more bytes have been transmitted** from response’s message body, then:
> 12.1.1.1.1. Let bytes be the transmitted bytes.
> 12.1.1.1.2. [...]
> 12.1.1.1.6. **Enqueue** a `Uint8Array` object wrapping an `ArrayBuffer` containing bytes to stream. [...]
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/pull/149#issuecomment-410760336
Received on Monday, 6 August 2018 16:06:14 UTC