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

Thanks, I understand it now (sorry, streams are quite new for me).

So, I was looking for a `lowWaterMark`, would it worth considering?
For example, my data need to go through a "decryption transform" and it requires a minimum amount of bytes. I managed to do it using a transform:

```js
var retainer = new TransformStream({
  retained: new Uint8Array(0), // Store this in the underlying source, not sure if it's a good thing
  transform(buffer, done, enqueue, close, err) {
    const view = new Uint8Array(buffer.buffer, this.retained.byteOffset, this.retained.byteLength + buffer.byteLength);
    const size = Math.floor(view.byteLength / 1024) * 1024; // Pipe only a multiple of 1024 bytes
    this.retained = new Uint8Array(view.buffer, view.byteOffset + size, view.byteLength - size);
    if (size) {
      enqueue(new Uint8Array(view.buffer, view.byteOffset, size));
    }
    done();
  }
});
```

(I do not have the code with me, it might be wrong)
(Sorry, still using the old TransformStream API)

-- 
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#issuecomment-255667934

Received on Monday, 24 October 2016 07:33:28 UTC