Using the fetch-function in a NodeJS application, I receive a response-object that contains a ReadableStream.
In my case, I want to catch errors and I try to figure out any response which could be part of the errornous request.
const res = await fetch(url);
if (!res.ok) {
console.log('Status:', res.status);
console.log('StatusText:', res.statusText);
//console.log(res);
const body = res.body;
console.log(body);
The console.log on the body gives:
ReadableStream { locked: false, state: 'readable', supportsBYOB: false }
How can I use the ReadableStream to get a real string?
I was reading on Mozilla Database but I don’t understand their corresponding article especially not the example, which looks really weird.