Re: [streams] How will ReadableByteStream work with seekable resources? (#253)

Sorry.  You're right.  Sorry for my confusion.  I do think `setAllocator()` could work.

To answer your question, I think an allocator function could handle this like so:

```
var rbs = new ReadableByteStream(/* ... */);

var bufferSize = 4096;
rbs.setAllocator({
  allocate: function() { new ArrayBuffer(bufferSize); }
});

rbs.read(); // uses 4096 byte buffer;

bufferSize = 136;
rbs.read() // uses 136 byte buffer
```

I don't really like depending on state between two statements like that, but it seems the `feedBuffer()` approach has the same problem.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/253#issuecomment-73922982

Received on Wednesday, 11 February 2015 17:23:32 UTC