Skip to content

Commit 335f405

Browse files
rexagodcodebytere
authored andcommittedJul 10, 2020
doc: link readable._read in stream.md
Refs: #33715 PR-URL: #33767 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3789c28 commit 335f405

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed
 

‎doc/api/stream.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ queue until it is consumed.
7979
Once the total size of the internal read buffer reaches the threshold specified
8080
by `highWaterMark`, the stream will temporarily stop reading data from the
8181
underlying resource until the data currently buffered can be consumed (that is,
82-
the stream will stop calling the internal `readable._read()` method that is
82+
the stream will stop calling the internal [`readable._read()`][] method that is
8383
used to fill the read buffer).
8484

8585
Data is buffered in `Writable` streams when the
@@ -2017,7 +2017,7 @@ console.log(w.data); // currency: €
20172017
The `stream.Readable` class is extended to implement a [`Readable`][] stream.
20182018

20192019
Custom `Readable` streams *must* call the `new stream.Readable([options])`
2020-
constructor and implement the `readable._read()` method.
2020+
constructor and implement the [`readable._read()`][] method.
20212021

20222022
#### `new stream.Readable([options])`
20232023
<!-- YAML
@@ -2097,27 +2097,27 @@ implemented by child classes, and called by the internal `Readable` class
20972097
methods only.
20982098

20992099
All `Readable` stream implementations must provide an implementation of the
2100-
`readable._read()` method to fetch data from the underlying resource.
2100+
[`readable._read()`][] method to fetch data from the underlying resource.
21012101

2102-
When `readable._read()` is called, if data is available from the resource, the
2103-
implementation should begin pushing that data into the read queue using the
2102+
When [`readable._read()`][] is called, if data is available from the resource,
2103+
the implementation should begin pushing that data into the read queue using the
21042104
[`this.push(dataChunk)`][stream-push] method. `_read()` should continue reading
21052105
from the resource and pushing data until `readable.push()` returns `false`. Only
21062106
when `_read()` is called again after it has stopped should it resume pushing
21072107
additional data onto the queue.
21082108

2109-
Once the `readable._read()` method has been called, it will not be called again
2110-
until more data is pushed through the [`readable.push()`][stream-push] method.
2111-
Empty data such as empty buffers and strings will not cause `readable._read()`
2112-
to be called.
2109+
Once the [`readable._read()`][] method has been called, it will not be called
2110+
again until more data is pushed through the [`readable.push()`][stream-push]
2111+
method. Empty data such as empty buffers and strings will not cause
2112+
[`readable._read()`][] to be called.
21132113

21142114
The `size` argument is advisory. For implementations where a "read" is a
21152115
single operation that returns data can use the `size` argument to determine how
21162116
much data to fetch. Other implementations may ignore this argument and simply
21172117
provide data whenever it becomes available. There is no need to "wait" until
21182118
`size` bytes are available before calling [`stream.push(chunk)`][stream-push].
21192119

2120-
The `readable._read()` method is prefixed with an underscore because it is
2120+
The [`readable._read()`][] method is prefixed with an underscore because it is
21212121
internal to the class that defines it, and should never be called directly by
21222122
user programs.
21232123

@@ -2200,7 +2200,7 @@ class SourceWrapper extends Readable {
22002200
```
22012201

22022202
The `readable.push()` method is used to push the content
2203-
into the internal buffer. It can be driven by the `readable._read()` method.
2203+
into the internal buffer. It can be driven by the [`readable._read()`][] method.
22042204

22052205
For streams not operating in object mode, if the `chunk` parameter of
22062206
`readable.push()` is `undefined`, it will be treated as empty string or
@@ -2273,7 +2273,7 @@ both base classes due to overriding [`Symbol.hasInstance`][] on
22732273
`stream.Writable`.
22742274

22752275
Custom `Duplex` streams *must* call the `new stream.Duplex([options])`
2276-
constructor and implement *both* the `readable._read()` and
2276+
constructor and implement *both* the [`readable._read()`][] and
22772277
`writable._write()` methods.
22782278

22792279
#### `new stream.Duplex(options)`
@@ -2436,10 +2436,10 @@ larger than its input.
24362436
The `stream.Transform` class is extended to implement a [`Transform`][] stream.
24372437

24382438
The `stream.Transform` class prototypically inherits from `stream.Duplex` and
2439-
implements its own versions of the `writable._write()` and `readable._read()`
2440-
methods. Custom `Transform` implementations *must* implement the
2441-
[`transform._transform()`][stream-_transform] method and *may* also implement
2442-
the [`transform._flush()`][stream-_flush] method.
2439+
implements its own versions of the `writable._write()` and
2440+
[`readable._read()`][] methods. Custom `Transform` implementations *must*
2441+
implement the [`transform._transform()`][stream-_transform] method and *may*
2442+
also implement the [`transform._flush()`][stream-_flush] method.
24432443

24442444
Care must be taken when using `Transform` streams in that data written to the
24452445
stream can cause the `Writable` side of the stream to become paused if the

0 commit comments

Comments
 (0)
Please sign in to comment.