Re: [whatwg/streams] What is the expected behaviour of .pipeThrough()? (#765)

@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