r/codesnip • u/wanoo21 • Oct 15 '26
Newly Available No more getReader() loops
The platform just killed another JavaScript snippet. 🔥
Async iterable streams are Baseline, newly available since September 2026. Safari 27 closed the gap.
Before this, reading a fetch body chunk by chunk meant getReader() and a while (true) loop.
Now ⤵️ it's one for await. 🤟
Bonus: break out of the loop, and the stream is canceled and unlocked for you. No manual releaseLock(). 😎
Want to keep it open? res.body.values({ preventCancel: true }).
MDN: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#async_iteration