Node.js Readable and Web API's ReadableStream both implement [Symbol.asyncIterator], which means you can usually use `for await` without extra code nowadays
async function* AsAsyncIterable<T>(
readable: ReadableStream<T>,
): AsyncIterable<T> {
const reader = readable.getReader()
try {
while (true) {
const { done, value } = await reader.read()
if (done) return
yield value
}
} finally {
reader.releaseLock()
}
}