- From: Adam Rice <notifications@github.com>
- Date: Thu, 09 Feb 2017 19:54:56 -0800
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 10 February 2017 03:55:30 UTC
@jakearchibald Do you mean like ```javascript let dec = new TextDecoder(); let writer = dec.writable.getWriter(); writer.write(incompleteByteSequence); writer.releaseLock(); await doSomethingWith(dec.readable); dec.readable.pipeTo(someOtherWritable()); ``` ? In this case what is written to `someOtherWritable()` does indeed depend on what was read by `doSomethingWith()`. The differences are: 1. This is consistent with how streams normally work. What data a second pipeTo() gets always depends on how much previous one read. 2. Regardless of where the characters end up, they are always the same characters. There is no possibility of getting different output depending on timing. The way @yhirano explained it to me was that the nondeterministic behaviour is caused by `writable` having its own buffer in addition to the one inside the TextDocoder object. A clean solution would be to force `dec.decode()` to use that buffer too, but that would be very complex to implement and require sophisticated optimisation to avoid a major performance regression. -- 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-278851330
Received on Friday, 10 February 2017 03:55:30 UTC