News for hackers. Stuff that matters.
Re:jQuery 4.1.0 by dwoldrich on Tuesday November 17, 2026 @07:15PM (#50540160)
Those original AJAX API's were pretty slick, but not well understood at the time. Surprisingly they could stream characters! The response is partially available each time onprogress fires:

  const xhr = new XMLHttpRequest();
  let lastLength = 0;

  xhr.addEventListener("progress", () => {
    const chunk = xhr.responseText.substring(lastLength);
    
    lastLength = xhr.responseText.length;

    console.log("New data:", chunk);
  });

  xhr.open("GET", "/stream");
  xhr.send();
-------------------

The modern fetch API is better though because it's a Promises API and it can stream as raw bytes, not characters:

  const response = await fetch("/stream");
  const reader = response.body.getReader();

  while (true) {
    const { value, done } = await reader.read(); 

    if (done) {    
        console.log("Finished");
        break;
    }

    console.log("Received", value.length, "bytes");
  }
Re:jQuery 4.1.0 by bastawhiz on Tuesday November 17, 2026 @07:52PM (#50540444)
It's actually a little easier these days:

  const response = await fetch("/stream");
  for await (const value of response.body) {
    console.log("Received", value.length, "bytes");
  }
  console.log("Finished")