Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: link readable._read in stream.md #33767

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ queue until it is consumed.
Once the total size of the internal read buffer reaches the threshold specified
by `highWaterMark`, the stream will temporarily stop reading data from the
underlying resource until the data currently buffered can be consumed (that is,
the stream will stop calling the internal `readable._read()` method that is
the stream will stop calling the internal [`readable._read()`][] method that is
used to fill the read buffer).

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

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

#### `new stream.Readable([options])`
<!-- YAML
Expand Down Expand Up @@ -2299,27 +2299,27 @@ implemented by child classes, and called by the internal `Readable` class
methods only.

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

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

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

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

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

Expand Down Expand Up @@ -2402,7 +2402,7 @@ class SourceWrapper extends Readable {
```

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

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

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

#### `new stream.Duplex(options)`
Expand Down Expand Up @@ -2678,10 +2678,10 @@ larger than its input.
The `stream.Transform` class is extended to implement a [`Transform`][] stream.

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

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