Re: [whatwg/encoding] Add Streams support (#72)

Let's make it more concrete. In the example in https://github.com/whatwg/encoding/issues/72#issuecomment-278578675, let `incompleteByteSequence` be `[0xf0, 0x9f, 0x92]` and `moreBytes` be `[0x99]`.

If `doSomethingWith()` performs a read, that read will return an empty string, and `what` will be '💙'.

If `doSomethingWith()` does not perform a read, then `what` will be set to '\ufffd' (the replacement character).

I'm not concerned about the example in https://github.com/whatwg/encoding/issues/72#issuecomment-363651543, because the output is the same regardless of who reads it.

> I guess I was more getting at the idea that they both could conceptually operate on the same underlying stream queues. As opposed to them being completely separate, but occupying the same object. I wasn't proposing actually adding a sync API.

To solve this issue, chunks which are in the TransformStream's writable's queue would need to be read by TextDecoder's `decode()` method. This requires all the machinery of a sync API to implement.

-- 
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/issues/72#issuecomment-366645392

Received on Monday, 19 February 2018 10:18:17 UTC