From the course: JavaScript: Service Workers

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Readable streams

Readable streams - JavaScript Tutorial

From the course: JavaScript: Service Workers

Start my 1-month free trial

Readable streams

- [Instructor] When a website is making a fetch to the network, so it's making an actual HTTP request, typically, the fetch goes to the web server, the web server takes the content from a file system, and that content goes through TCP or UDP in packets through the network. So, in chunks. Probably, you've heard about this even if you're not a specialist in network. When you're downloading files, these files are coming from the network, on internet, in different packets, smaller pieces that are traveling along, and then, typically, the browser is basically waiting for all the small pieces to appear and then give you the original content. And that's in the fetch event when the promise is fulfilled, and your then callback is being executed. So, meaning that, you will render the content, or you will use the content, when all the pieces were downloaded. Sometimes it's not even about the network. It's about, also, the operating system that is parsing each packet individually. So fortunately…

Contents