- From: guest271314 <notifications@github.com>
- Date: Sun, 20 Aug 2017 01:58:04 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/765/323558312@github.com>
@domenic Have not been able to, as of yet, wait for `writable` portion `close()` to be called before `readable` begins using `.pipeThrough()`, though have been able to achieve the same utilizing a variation of your code ``` function pipeThrough(data) { "use strict"; console.clear(); const readable; const writable = new WritableStream({ write(chunk) { readable = new ReadableStream({ pull(c) { c.enqueue(chunk); c.close(); } }) }, close(c) { console.log("done") } }); const writer = writable.getWriter(); writer.write(data); writer.close(); return writer.closed.then(() => { console.log("really done"); return readable }); } pipeThrough([1, 2, 3]) .then(reader => { const stream = reader.getReader(); const fn = ({value,done}) => { if (done) return stream.closed.then(() => ({done})); console.log(value, done); return stream.read().then(fn) } return stream.read().then(fn) }) .then(done => console.log(done)); ``` Is it possible to adjust your code at the second working technique to use `.pipeThrough()` to wait for `writable` `close()` to be called before `readable` portion is read? That is `"Writable side of transform closing"` being logged before `"Reading chunk from output"`? Or does the order described above not matter according to the specification? -- 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/streams/issues/765#issuecomment-323558312
Received on Sunday, 20 August 2017 01:58:26 UTC