Skip to content

Commit

Permalink
doc,stream: split finish and end events into separate entries
Browse files Browse the repository at this point in the history
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: nodejs#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>
  • Loading branch information
Trott committed Jun 17, 2020
1 parent 14d012e commit ee7f0e3
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions doc/api/stream.md
Expand Up @@ -2734,15 +2734,19 @@ const myTransform = new Transform({
});
```

#### Events: `'finish'` and `'end'`
#### Event: `'end'`

The [`'finish'`][] and [`'end'`][] events are from the `stream.Writable`
and `stream.Readable` classes, respectively. The `'finish'` event is emitted
after [`stream.end()`][stream-end] is called and all chunks have been processed
by [`stream._transform()`][stream-_transform]. The `'end'` event is emitted
after all data has been output, which occurs after the callback in
The [`'end'`][] event is from the `stream.Readable` class. The `'end'` event is
emitted after all data has been output, which occurs after the callback in
[`transform._flush()`][stream-_flush] has been called. In the case of an error,
neither `'finish'` nor `'end'` should be emitted.
`'end'` should not be emitted.

#### Event: `'finish'`

The [`'finish'`][] event is from the `stream.Writable` class. The `'finish'`
event is emitted after [`stream.end()`][stream-end] is called and all chunks
have been processed by [`stream._transform()`][stream-_transform]. In the case
of an error, `'finish'` should not be emitted.

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

Expand Down

0 comments on commit ee7f0e3

Please sign in to comment.