[whatwg/streams] The implementation of ByteLengthQueuingStrategy does not behave as expect (#551)

Hi,

Reading the spec, I understand that applying a `ByteLengthQueuingStrategy` to a `ReadableStream` will buffer the given amount of bytes and pass this through the pipe when reached the highWaterMark. Am I correct?

I tried with something like that:
```js
const readable = new ReadableStream({
  start(controller) {
    return self.fetch(…).then(response => {
      const reader = response.body.getReader();
      return reader.read().then(function process(result) {
        if (result.done) { return; }
        controller.enqueue(result.value);
        return reader.read().then(process);
      });
    });
  }
}, new ByteLengthQueuingStrategy({highWaterMark: 1024}));

readable
  .pipeThrough(new TransformStream({
    transform(buffer, done, enqueue, close, err) {
      console.log('Buffer size:', buffer.length); // Should always be 1024
      enqueue(buffer);
      return done();
    }
  }));
```

But it seams the `TransformStream` is called whenever there is data enqueued to the `ReadableStreamController`.

P.S. : Not really sure of this issue's title.
P.P.S. : Thanks for the good work 👍 

-- 
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/551

Received on Friday, 21 October 2016 12:00:33 UTC