From d12487475ab9113a6aff10da42a877ee4f594531 Mon Sep 17 00:00:00 2001 From: Ivan Filenko Date: Tue, 13 Mar 2018 23:45:51 +0300 Subject: [PATCH 1/4] doc: add note to readable stream async iterator docs --- doc/api/stream.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index d80837022ba500..8114fe988cce77 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1197,7 +1197,9 @@ print(fs.createReadStream('file')).catch(console.log); If the loop terminates with a `break` or a `throw`, the stream will be destroyed. In other terms, iterating over a stream will consume the stream -fully. +fully. +Note that by default file iteration would be by the chunks of the size equal +to `highWaterMark` value (default is 64kb for [`fs.createReadStream()`][]). ### Duplex and Transform Streams From 042cf853ea151f956eb2a1a8ff5582d82094974a Mon Sep 17 00:00:00 2001 From: Ivan Filenko Date: Wed, 14 Mar 2018 02:03:25 +0300 Subject: [PATCH 2/4] doc: rephrase the note to make it clearer --- doc/api/stream.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 8114fe988cce77..b3190435617245 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1198,8 +1198,9 @@ print(fs.createReadStream('file')).catch(console.log); If the loop terminates with a `break` or a `throw`, the stream will be destroyed. In other terms, iterating over a stream will consume the stream fully. -Note that by default file iteration would be by the chunks of the size equal -to `highWaterMark` value (default is 64kb for [`fs.createReadStream()`][]). +Note that by default, async reading of the contents of the file will be +performed by chunks of size equal to `highWaterMark` value (default is 64kb +for [`fs.createReadStream()`][]). ### Duplex and Transform Streams From 3aa49be2f335d295c898f20086b53669d72f8b24 Mon Sep 17 00:00:00 2001 From: Ivan Filenko Date: Fri, 16 Mar 2018 03:12:08 +0300 Subject: [PATCH 3/4] doc: generalize the note after rewiew suggestions --- doc/api/stream.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index b3190435617245..85f91559b8cec5 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1198,9 +1198,10 @@ print(fs.createReadStream('file')).catch(console.log); If the loop terminates with a `break` or a `throw`, the stream will be destroyed. In other terms, iterating over a stream will consume the stream fully. -Note that by default, async reading of the contents of the file will be -performed by chunks of size equal to `highWaterMark` value (default is 64kb -for [`fs.createReadStream()`][]). +The stream will be read in chunks of size equal to the `highWaterMark` option. +In the code example above, data will be in a single chunk if the file has less +then 64kb of data because no `highWaterMark` option is provided to +[`fs.createReadStream()`][]. ### Duplex and Transform Streams From 3088fb222cb059f7351f4293a3d7bea3213536c1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 17 Mar 2018 09:02:37 -0700 Subject: [PATCH 4/4] Update stream.md --- doc/api/stream.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 85f91559b8cec5..b6bd4495e6df33 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1197,10 +1197,9 @@ print(fs.createReadStream('file')).catch(console.log); If the loop terminates with a `break` or a `throw`, the stream will be destroyed. In other terms, iterating over a stream will consume the stream -fully. -The stream will be read in chunks of size equal to the `highWaterMark` option. -In the code example above, data will be in a single chunk if the file has less -then 64kb of data because no `highWaterMark` option is provided to +fully. The stream will be read in chunks of size equal to the `highWaterMark` +option. In the code example above, data will be in a single chunk if the file +has less then 64kb of data because no `highWaterMark` option is provided to [`fs.createReadStream()`][]. ### Duplex and Transform Streams