From f4e9c5eba3ba3b945582c81cac8250e1fb08214a Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Sat, 24 Jun 2023 22:32:32 -0700 Subject: [PATCH 1/3] Update language/grammar on streams api page --- files/en-us/web/api/streams_api/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/files/en-us/web/api/streams_api/index.md b/files/en-us/web/api/streams_api/index.md index 80f26f32387f5b5..4b639f53d5bb203 100644 --- a/files/en-us/web/api/streams_api/index.md +++ b/files/en-us/web/api/streams_api/index.md @@ -15,17 +15,17 @@ The Streams API allows JavaScript to programmatically access streams of data rec ## Concepts and usage -Streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. This is something browsers do anyway when receiving assets to be shown on webpages — videos buffer and more is gradually available to play, and sometimes you'll see images display gradually as more is loaded. +Streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. Browsers already do when receiving media assets — videos buffer and play as more of the content downloads, and sometimes you'll see images display gradually as more is loaded too. -But this has never been available to JavaScript before. Previously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot after it is fully received. +But this capability has never been available to JavaScript before. Previously, if we wanted to process a resource of some kind (video, text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the all the data. -With Streams being available to JavaScript, this all changes — you can now start processing raw data with JavaScript bit by bit as soon as it is available on the client-side, without needing to generate a buffer, string, or blob. +With the Streams API, you can start processing raw data with JavaScript bit by bit, as soon as it is available, without needing to generate a buffer, string, or blob. ![The basic concept of the stream API is data is fetched from the network in several data packets. The data is processed, and then sent to the browser in a stream of data packets.](concept.png) -There are more advantages too — you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed the stream is being read at. +There are more advantages too — you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed at which the stream is being read. -The basic usage of Streams hinges around making responses available as streams. For example, the response body returned by a successful [fetch request](/en-US/docs/Web/API/fetch) can be exposed as a {{domxref("ReadableStream")}}, and you can then read it using a reader created with {{domxref("ReadableStream.getReader()")}}, cancel it with {{domxref("ReadableStream.cancel()")}}, etc. +The usage of Streams hinges on making responses available as streams. For example, the response body of a [fetch request](/en-US/docs/Web/API/fetch) can be a {{domxref("ReadableStream")}} that can be read by a reader created with {{domxref("ReadableStream.getReader()")}}, and canceled with {{domxref("ReadableStream.cancel()")}}, etc. More complicated uses involve creating your own stream using the {{domxref("ReadableStream.ReadableStream", "ReadableStream()")}} constructor, for example to process data inside a [service worker](/en-US/docs/Web/API/Service_Worker_API). From f58126d2cfa4c85eb64722ea64ebb0590e9f08d4 Mon Sep 17 00:00:00 2001 From: wbamberg Date: Thu, 20 Jul 2023 14:49:31 -0700 Subject: [PATCH 2/3] typo --- files/en-us/web/api/streams_api/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/streams_api/index.md b/files/en-us/web/api/streams_api/index.md index 4b639f53d5bb203..2a9a7552c99a436 100644 --- a/files/en-us/web/api/streams_api/index.md +++ b/files/en-us/web/api/streams_api/index.md @@ -15,7 +15,7 @@ The Streams API allows JavaScript to programmatically access streams of data rec ## Concepts and usage -Streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. Browsers already do when receiving media assets — videos buffer and play as more of the content downloads, and sometimes you'll see images display gradually as more is loaded too. +Streaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. Browsers already do this when receiving media assets — videos buffer and play as more of the content downloads, and sometimes you'll see images display gradually as more is loaded too. But this capability has never been available to JavaScript before. Previously, if we wanted to process a resource of some kind (video, text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the all the data. From 276eed7e4ddaa08ca4d4fef6e015572a328ea42e Mon Sep 17 00:00:00 2001 From: wbamberg Date: Thu, 20 Jul 2023 14:53:55 -0700 Subject: [PATCH 3/3] copy edit --- files/en-us/web/api/streams_api/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/en-us/web/api/streams_api/index.md b/files/en-us/web/api/streams_api/index.md index 2a9a7552c99a436..dadd2e899600991 100644 --- a/files/en-us/web/api/streams_api/index.md +++ b/files/en-us/web/api/streams_api/index.md @@ -25,7 +25,7 @@ With the Streams API, you can start processing raw data with JavaScript bit by b There are more advantages too — you can detect when streams start or end, chain streams together, handle errors and cancel streams as required, and react to the speed at which the stream is being read. -The usage of Streams hinges on making responses available as streams. For example, the response body of a [fetch request](/en-US/docs/Web/API/fetch) can be a {{domxref("ReadableStream")}} that can be read by a reader created with {{domxref("ReadableStream.getReader()")}}, and canceled with {{domxref("ReadableStream.cancel()")}}, etc. +The usage of Streams hinges on making responses available as streams. For example, the response body returned by a successful [fetch request](/en-US/docs/Web/API/fetch) is a {{domxref("ReadableStream")}} that can be read by a reader created with {{domxref("ReadableStream.getReader()")}}. More complicated uses involve creating your own stream using the {{domxref("ReadableStream.ReadableStream", "ReadableStream()")}} constructor, for example to process data inside a [service worker](/en-US/docs/Web/API/Service_Worker_API).