This commit is contained in:
Skylar Grant 2025-01-04 10:44:32 -05:00
parent 86ebb3f424
commit 3ae1c24e3c

View File

@ -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>`;
}