Say I have a ReadableStream object (from the Streams API web standard):
let readableStream = (await fetch('http://example.com')).body;
I know I can read it chunk by chunk, where the chunk size usually depends on the network:
for await (let chunk of readableStream) {
let chunkString = new TextDecoder().decode(chunk);
console.dir(chunkString);
}
But how do I read a ReadableStream line by line?
(Note that lines can span multiple chunks, so it's not enough to just split every chunk.)