- From: guest271314 <notifications@github.com>
- Date: Sat, 19 Aug 2017 21:50:23 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 19 August 2017 21:50:46 UTC
@domenic The linked jsbin logs `writable` part last, where `readable` is expected to be returned, yes? Is this similar pattern using `.pipeTo()` similar to the expected implementation of `.pipeThrough()`?
```
async function pipeThrough({
data, stream,
readable, writable, CHUNK = void 0
}) {
await stream.pipeTo(new WritableStream(writable));
return new ReadableStream(readable)
}
pipeThrough({
data: [1, 2, 3],
stream: new ReadableStream({
pull(c) {
c.enqueue([1, 2, 3]);
c.close()
}
}),
writable: {
write(chunk) {
console.log("writable:", chunk);
CHUNK = chunk.map(c => c * 10);
},
close() {
console.log("writeable closed")
}
},
readable: {
pull(c) {
console.log("readable:", CHUNK);
c.enqueue(CHUNK);
c.close();
},
cancel() {
console.log("readable closed");
}
}
})
.then(readable =>
readable
.pipeTo(
new WritableStream({
write(data) {
console.log(data)
},
close() {
console.log("complete")
}
})
)
)
```
--
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-323549692
Received on Saturday, 19 August 2017 21:50:46 UTC