Re: [whatwg/streams] Question: what is the difference of pipeThrough and pipeTo? (#515)

Ok, think that it is for now. Haven't yet found a use case for it yet.
But if you would want to implement the TextEncoder your self would it be done something like this then?

```javascript
function transform(){
 let enqueueInReadable;
 let closeReadable;
 let encoder = new TextEncoder
 
 return {
  writable: new WritableStream({
   write(chunk) {
    enqueueInReadable(encoder.encode(chunk));
   }
  })
  
  readable: new ReadableStream({
   start(c) {
    enqueueInReadable = c.enqueue.bind(c);
    closeReadable = c.close.bind(c);
   }
  })
 };
}


someStream
 .pipeThrough(transform())
 .pipeTo(log)
```

-- 
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/515#issuecomment-244476671

Received on Friday, 2 September 2016 20:14:27 UTC