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'); const decoder = new TextDecoder('utf-8');
try { try {
// Recursive function to read the stream function read() {
reader.read().then(( done, value ) => { // Recursive function to read the stream
console.log(`Done: ${done}`); reader.read().then(( done, value ) => {
console.log(`Value: ${value}`); console.log(`Done: ${JSON.stringify(done)}`);
if (done) { console.log(`Value: ${new TextDecoder().decode(value)}`);
return; if (done) {
} return;
}); }
read();
});
}
read();
} catch (error) { } catch (error) {
outputArea.innerHTML = `<span class="text-red-500">Error: ${error.message}</span>`; outputArea.innerHTML = `<span class="text-red-500">Error: ${error.message}</span>`;
} }