?
This commit is contained in:
parent
86ebb3f424
commit
3ae1c24e3c
@ -26,14 +26,18 @@ async function readResponse(response) {
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
|
||||
try {
|
||||
// Recursive function to read the stream
|
||||
reader.read().then(( done, value ) => {
|
||||
console.log(`Done: ${done}`);
|
||||
console.log(`Value: ${value}`);
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
function read() {
|
||||
// Recursive function to read the stream
|
||||
reader.read().then(( done, value ) => {
|
||||
console.log(`Done: ${JSON.stringify(done)}`);
|
||||
console.log(`Value: ${new TextDecoder().decode(value)}`);
|
||||
if (done) {
|
||||
return;
|
||||
}
|
||||
read();
|
||||
});
|
||||
}
|
||||
read();
|
||||
} catch (error) {
|
||||
outputArea.innerHTML = `<span class="text-red-500">Error: ${error.message}</span>`;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user