- From: Adam Rice <notifications@github.com>
- Date: Wed, 28 Mar 2018 04:02:11 +0000 (UTC)
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/911/c376754142@github.com>
Great stuff! - I'd like `GrayscalePNGSource` to be a transform stream. Wrapping a ReadableStream inside another ReadableStream is a pattern I'm trying to discourage. I realise the fact that no browser has shipped TransformStream yet makes this inconvenient! If it's not possible to change this, could we link only to "Unpack chunks of a PNG" for the time being? - In `logReadableStream()`, it would be much easier to create a WritableStream and then pipe to it. Basically the contents of `pump()` would instead be in the `write()` method, except for the `if (done)` part which would go in the `close()` method. Try it, I think you'll like it! As a general rule, any time you're using `getReader()` or `getWriter()`, you should think about whether there would be a simpler way to do it with `pipeTo()` or `pipeThrough()`. General comments: - It looks like `GrayscalePNGSource` won't work properly unless the input is an rgba PNG. Maybe it should throw in other cases? - Using ```javascript const {value, done} = await reader.read(); ``` inside a loop in an async function is much easier and cleaner that using a `pump()` function. I think all the browsers that have or will have ReadableStream already support async/await. It took me a while to understand what "Unpack chunks of a PNG" was doing. It would probably benefit from a bit more documentation. -- 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/pull/911#issuecomment-376754142
Received on Wednesday, 28 March 2018 04:02:35 UTC