Skip to content

Commit

Permalink
doc: update emitClose default for fs streams
Browse files Browse the repository at this point in the history
The default for the `emitClose` option was changed from `false` to
`true` by #31408 which landed in f0d2df4 for v14.0.0.
This commit updates the fs doc to match the current behavior.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>

PR-URL: #36653
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
  • Loading branch information
kevinoid authored and MylesBorins committed Aug 31, 2021
1 parent 4a88dde commit 298a16a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions doc/api/fs.md
Expand Up @@ -1758,6 +1758,9 @@ fs.copyFileSync('source.txt', 'destination.txt', COPYFILE_EXCL);
<!-- YAML
added: v0.1.31
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31408
description: Change `emitClose` default to `true`.
- version: v13.6.0
pr-url: https://github.com/nodejs/node/pull/29083
description: The `fs` options allow overriding the used `fs`
Expand Down Expand Up @@ -1790,7 +1793,7 @@ changes:
* `fd` {integer} **Default:** `null`
* `mode` {integer} **Default:** `0o666`
* `autoClose` {boolean} **Default:** `true`
* `emitClose` {boolean} **Default:** `false`
* `emitClose` {boolean} **Default:** `true`
* `start` {integer}
* `end` {integer} **Default:** `Infinity`
* `highWaterMark` {integer} **Default:** `64 * 1024`
Expand Down Expand Up @@ -1818,9 +1821,9 @@ If `fd` points to a character device that only supports blocking reads
available. This can prevent the process from exiting and the stream from
closing naturally.

By default, the stream will not emit a `'close'` event after it has been
destroyed. This is the opposite of the default for other `Readable` streams.
Set the `emitClose` option to `true` to change this behavior.
By default, the stream will emit a `'close'` event after it has been
destroyed, like most `Readable` streams. Set the `emitClose` option to
`false` to change this behavior.

By providing the `fs` option, it is possible to override the corresponding `fs`
implementations for `open`, `read`, and `close`. When providing the `fs` option,
Expand Down Expand Up @@ -1863,6 +1866,9 @@ If `options` is a string, then it specifies the encoding.
<!-- YAML
added: v0.1.31
changes:
- version: v14.0.0
pr-url: https://github.com/nodejs/node/pull/31408
description: Change `emitClose` default to `true`.
- version: v13.6.0
pr-url: https://github.com/nodejs/node/pull/29083
description: The `fs` options allow overriding the used `fs`
Expand Down Expand Up @@ -1893,7 +1899,7 @@ changes:
* `fd` {integer} **Default:** `null`
* `mode` {integer} **Default:** `0o666`
* `autoClose` {boolean} **Default:** `true`
* `emitClose` {boolean} **Default:** `false`
* `emitClose` {boolean} **Default:** `true`
* `start` {integer}
* `fs` {Object|null} **Default:** `null`
* Returns: {fs.WriteStream} See [Writable Stream][].
Expand All @@ -1910,9 +1916,9 @@ then the file descriptor won't be closed, even if there's an error.
It is the application's responsibility to close it and make sure there's no
file descriptor leak.

By default, the stream will not emit a `'close'` event after it has been
destroyed. This is the opposite of the default for other `Writable` streams.
Set the `emitClose` option to `true` to change this behavior.
By default, the stream will emit a `'close'` event after it has been
destroyed, like most `Writable` streams. Set the `emitClose` option to
`false` to change this behavior.

By providing the `fs` option it is possible to override the corresponding `fs`
implementations for `open`, `write`, `writev` and `close`. Overriding `write()`
Expand Down

0 comments on commit 298a16a

Please sign in to comment.