Skip to content

Commit ee7f0e3

Browse files
committed
doc,stream: split finish and end events into separate entries
The stream doc has the only instance in our docs where two events are combined into a single entry. Split them into separate adjacent entries. PR-URL: #33881 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 14d012e commit ee7f0e3

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

doc/api/stream.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,15 +2734,19 @@ const myTransform = new Transform({
27342734
});
27352735
```
27362736

2737-
#### Events: `'finish'` and `'end'`
2737+
#### Event: `'end'`
27382738

2739-
The [`'finish'`][] and [`'end'`][] events are from the `stream.Writable`
2740-
and `stream.Readable` classes, respectively. The `'finish'` event is emitted
2741-
after [`stream.end()`][stream-end] is called and all chunks have been processed
2742-
by [`stream._transform()`][stream-_transform]. The `'end'` event is emitted
2743-
after all data has been output, which occurs after the callback in
2739+
The [`'end'`][] event is from the `stream.Readable` class. The `'end'` event is
2740+
emitted after all data has been output, which occurs after the callback in
27442741
[`transform._flush()`][stream-_flush] has been called. In the case of an error,
2745-
neither `'finish'` nor `'end'` should be emitted.
2742+
`'end'` should not be emitted.
2743+
2744+
#### Event: `'finish'`
2745+
2746+
The [`'finish'`][] event is from the `stream.Writable` class. The `'finish'`
2747+
event is emitted after [`stream.end()`][stream-end] is called and all chunks
2748+
have been processed by [`stream._transform()`][stream-_transform]. In the case
2749+
of an error, `'finish'` should not be emitted.
27462750

27472751
#### `transform._flush(callback)`
27482752

0 commit comments

Comments
 (0)