Skip to content

Commit cd43946

Browse files
vsemozhetbytevanlucas
authored andcommitted
doc: fix typos in the stream doc
PR-URL: #7336 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent dddfed2 commit cd43946

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

doc/api/stream.md

+32-32
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ There are four fundamental stream types within Node.js:
3838
* [Readable][] - streams from which data can be read (for example
3939
[`fs.createReadStream()`][]).
4040
* [Writable][] - streams to which data can be written (for example
41-
[`fs.createWriteStream`][]).
41+
[`fs.createWriteStream()`][]).
4242
* [Duplex][] - streams that are both Readable and Writable (for example
4343
[`net.Socket`][]).
4444
* [Transform][] - Duplex streams that can modify or transform the data as it
@@ -77,7 +77,7 @@ queue until it is consumed.
7777
Once the total size of the internal read buffer reaches the threshold specified
7878
by `highWaterMark`, the stream will temporarily stop reading data from the
7979
underlying resource until the data currently buffered can be consumed (that is,
80-
the stream will stop calling the internal `readable.\_read()` method that is
80+
the stream will stop calling the internal `readable._read()` method that is
8181
used to fill the read buffer).
8282

8383
Data is buffered in Writable streams when the
@@ -321,7 +321,7 @@ The buffered data will be flushed when either the [`stream.uncork()`][] or
321321
The primary intent of `writable.cork()` is to avoid a situation where writing
322322
many small chunks of data to a stream do not cause an backup in the internal
323323
buffer that would have an adverse impact on performance. In such situations,
324-
implementations that implement the `writable.\_writev()` method can perform
324+
implementations that implement the `writable._writev()` method can perform
325325
buffered writes in a more optimized manner.
326326

327327
##### writable.end([chunk][, encoding][, callback])
@@ -786,7 +786,7 @@ following example:
786786

787787
```js
788788
getReadableStreamSomehow()
789-
.resume();
789+
.resume()
790790
.on('end', () => {
791791
console.log('Reached the end, but did not read anything.');
792792
});
@@ -1083,8 +1083,8 @@ const myWritable = new Writable({
10831083
The `stream.Writable` class is extended to implement a [Writable][] stream.
10841084

10851085
Custom Writable streams *must* call the `new stream.Writable([options])`
1086-
constructor and implement the `writable.\_write()` method. The
1087-
`writable.\_writev()` method *may* also be implemented.
1086+
constructor and implement the `writable._write()` method. The
1087+
`writable._writev()` method *may* also be implemented.
10881088

10891089
#### Constructor: new stream.Writable([options])
10901090

@@ -1161,7 +1161,7 @@ All Writable stream implementations must provide a
11611161
resource.
11621162

11631163
*Note*: [Transform][] streams provide their own implementation of the
1164-
[`writable._write()`].
1164+
[`writable._write()`][stream-_write].
11651165

11661166
*Note*: **This function MUST NOT be called by application code directly.** It
11671167
should be implemented by child classes, and called only by the internal Writable
@@ -1173,10 +1173,10 @@ successfully or failed with an error. The first argument passed to the
11731173
write succeeded.
11741174

11751175
It is important to note that all calls to `writable.write()` that occur between
1176-
the time `writable.\_write()` is called and the `callback` is called will cause
1176+
the time `writable._write()` is called and the `callback` is called will cause
11771177
the written data to be buffered. Once the `callback` is invoked, the stream will
11781178
emit a `'drain'` event. If a stream implementation is capable of processing
1179-
multiple chunks of data at once, the `writable.\_writev()` method should be
1179+
multiple chunks of data at once, the `writable._writev()` method should be
11801180
implemented.
11811181

11821182
If the `decodeStrings` property is set in the constructor options, then
@@ -1187,7 +1187,7 @@ data encodings. If the `decodeStrings` property is explicitly set to `false`,
11871187
the `encoding` argument can be safely ignored, and `chunk` will always be a
11881188
`Buffer`.
11891189

1190-
The `writable.\_write()` method is prefixed with an underscore because it is
1190+
The `writable._write()` method is prefixed with an underscore because it is
11911191
internal to the class that defines it, and should never be called directly by
11921192
user programs.
11931193

@@ -1202,22 +1202,22 @@ user programs.
12021202
should be implemented by child classes, and called only by the internal Writable
12031203
class methods only.
12041204

1205-
The `writable.\_writev()` method may be implemented in addition to
1206-
`writable.\_write()` in stream implementations that are capable of processing
1205+
The `writable._writev()` method may be implemented in addition to
1206+
`writable._write()` in stream implementations that are capable of processing
12071207
multiple chunks of data at once. If implemented, the method will be called with
12081208
all chunks of data currently buffered in the write queue.
12091209

1210-
The `writable.\_writev()` method is prefixed with an underscore because it is
1210+
The `writable._writev()` method is prefixed with an underscore because it is
12111211
internal to the class that defines it, and should never be called directly by
12121212
user programs.
12131213

12141214
#### Errors While Writing
12151215

12161216
It is recommended that errors occurring during the processing of the
1217-
`writable.\_write()` and `writable.\_writev()` methods are reported by invoking
1217+
`writable._write()` and `writable._writev()` methods are reported by invoking
12181218
the callback and passing the error as the first argument. This will cause an
12191219
`'error'` event to be emitted by the Writable. Throwing an Error from within
1220-
`writable.\_write()` can result in expected and inconsistent behavior depending
1220+
`writable._write()` can result in expected and inconsistent behavior depending
12211221
on how the stream is being used. Using the callback ensures consistent and
12221222
predictable handling of errors.
12231223

@@ -1265,7 +1265,7 @@ class MyWritable extends Writable {
12651265
The `stream.Readable` class is extended to implement a [Readable][] stream.
12661266

12671267
Custom Readable streams *must* call the `new stream.Readable([options])`
1268-
constructor and implement the `readable.\_read()` method.
1268+
constructor and implement the `readable._read()` method.
12691269

12701270
#### new stream.Readable([options])
12711271

@@ -1329,7 +1329,7 @@ should be implemented by child classes, and called only by the internal Readable
13291329
class methods only.
13301330

13311331
All Readable stream implementations must provide an implementation of the
1332-
`readable.\_read()` method to fetch data from the underlying resource.
1332+
`readable._read()` method to fetch data from the underlying resource.
13331333

13341334
When `readable._read()` is called, if data is available from the resource, the
13351335
implementation should begin pushing that data into the read queue using the
@@ -1347,7 +1347,7 @@ much data to fetch. Other implementations may ignore this argument and simply
13471347
provide data whenever it becomes available. There is no need to "wait" until
13481348
`size` bytes are available before calling [`stream.push(chunk)`][stream-push].
13491349

1350-
The `readable.\_read()` method is prefixed with an underscore because it is
1350+
The `readable._read()` method is prefixed with an underscore because it is
13511351
internal to the class that defines it, and should never be called directly by
13521352
user programs.
13531353

@@ -1407,13 +1407,13 @@ class SourceWrapper extends Readable {
14071407
}
14081408
```
14091409
*Note*: The `readable.push()` method is intended be called only by Readable
1410-
Implemeters, and only from within the `readable.\_read()` method.
1410+
Implemeters, and only from within the `readable._read()` method.
14111411

14121412
#### Errors While Reading
14131413

14141414
It is recommended that errors occurring during the processing of the
1415-
`readable.\_read()` method are emitted using the `'error'` event rather than
1416-
being thrown. Throwing an Error from within `readable.\_read()` can result in
1415+
`readable._read()` method are emitted using the `'error'` event rather than
1416+
being thrown. Throwing an Error from within `readable._read()` can result in
14171417
expected and inconsistent behavior depending on whether the stream is operating
14181418
in flowing or paused mode. Using the `'error'` event ensures consistent and
14191419
predictable handling of errors.
@@ -1475,8 +1475,8 @@ to extending the `stream.Readable` *and* `stream.Writable` classes).
14751475
and parasitically from `stream.Writable`.
14761476

14771477
Custom Duplex streams *must* call the `new stream.Duplex([options])`
1478-
constructor and implement *both* the `readable.\_read()` and
1479-
`writable.\_write()` methods.
1478+
constructor and implement *both* the `readable._read()` and
1479+
`writable._write()` methods.
14801480

14811481
#### new stream.Duplex(options)
14821482

@@ -1629,10 +1629,10 @@ that is either much smaller or much larger than its input.
16291629
The `stream.Transform` class is extended to implement a [Transform][] stream.
16301630

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

16371637
*Note*: Care must be taken when using Transform streams in that data written
16381638
to the stream can cause the Writable side of the stream to become paused if
@@ -1709,16 +1709,16 @@ store an amount of internal state used to optimally compress the output. When
17091709
the stream ends, however, that additional data needs to be flushed so that the
17101710
compressed data will be complete.
17111711

1712-
Custom [Transform][] implementations *may* implement the `transform.\_flush()`
1712+
Custom [Transform][] implementations *may* implement the `transform._flush()`
17131713
method. This will be called when there is no more written data to be consumed,
17141714
but before the [`'end'`][] event is emitted signaling the end of the
17151715
[Readable][] stream.
17161716

1717-
Within the `transform.\_flush()` implementation, the `readable.push()` method
1717+
Within the `transform._flush()` implementation, the `readable.push()` method
17181718
may be called zero or more times, as appropriate. The `callback` function must
17191719
be called when the flush operation is complete.
17201720

1721-
The `transform.\_flush()` method is prefixed with an underscore because it is
1721+
The `transform._flush()` method is prefixed with an underscore because it is
17221722
internal to the class that defines it, and should never be called directly by
17231723
user programs.
17241724

@@ -1738,7 +1738,7 @@ should be implemented by child classes, and called only by the internal Readable
17381738
class methods only.
17391739

17401740
All Transform stream implementations must provide a `_transform()`
1741-
method to accept input and produce output. The `transform.\_transform()`
1741+
method to accept input and produce output. The `transform._transform()`
17421742
implementation handles the bytes being written, computes an output, then passes
17431743
that output off to the readable portion using the `readable.push()` method.
17441744

@@ -1765,7 +1765,7 @@ transform.prototype._transform = function (data, encoding, callback) {
17651765
};
17661766
```
17671767

1768-
The `transform.\_transform()` method is prefixed with an underscore because it
1768+
The `transform._transform()` method is prefixed with an underscore because it
17691769
is internal to the class that defines it, and should never be called directly by
17701770
user programs.
17711771

@@ -1848,7 +1848,7 @@ net.createServer((socket) => {
18481848

18491849
In addition to new Readable streams switching into flowing mode,
18501850
pre-v0.10 style streams can be wrapped in a Readable class using the
1851-
[`readable.wrap()`][] method.
1851+
[`readable.wrap()`][`stream.wrap()`] method.
18521852

18531853

18541854
### `readable.read(0)`

0 commit comments

Comments
 (0)