Skip to content

Commit f14f813

Browse files
kevinoidfoxxyz
authored andcommitted
doc: update emitClose default for fs streams
The default for the `emitClose` option was changed from `false` to `true` by nodejs#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: nodejs#36653 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
1 parent 27696fb commit f14f813

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

doc/api/fs.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,9 @@ fs.copyFileSync('source.txt', 'destination.txt', COPYFILE_EXCL);
17581758
<!-- YAML
17591759
added: v0.1.31
17601760
changes:
1761+
- version: v14.0.0
1762+
pr-url: https://github.com/nodejs/node/pull/31408
1763+
description: Change `emitClose` default to `true`.
17611764
- version: v13.6.0
17621765
pr-url: https://github.com/nodejs/node/pull/29083
17631766
description: The `fs` options allow overriding the used `fs`
@@ -1790,7 +1793,7 @@ changes:
17901793
* `fd` {integer} **Default:** `null`
17911794
* `mode` {integer} **Default:** `0o666`
17921795
* `autoClose` {boolean} **Default:** `true`
1793-
* `emitClose` {boolean} **Default:** `false`
1796+
* `emitClose` {boolean} **Default:** `true`
17941797
* `start` {integer}
17951798
* `end` {integer} **Default:** `Infinity`
17961799
* `highWaterMark` {integer} **Default:** `64 * 1024`
@@ -1818,9 +1821,9 @@ If `fd` points to a character device that only supports blocking reads
18181821
available. This can prevent the process from exiting and the stream from
18191822
closing naturally.
18201823

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

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

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

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

0 commit comments

Comments
 (0)