Here is the fetch request that I am working with:
fetch('https://cdnjs.cloudflare.com/ajax/libs/jsbeautify/1.7.5/beautify.js')
.then(function (result) {
console.log('here is our content:', result.body);
})
.catch(function (err) {
console.error(err.message);
});
...
From what I understand, result.body
is a ReadableStream
. Since the data is not in JSON format, using result.json()
results in an error.
How can I go about reading the text from the response?