From d548f4d1164a5dc9e1390fcaaafbbf2feddaf28e Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Sun, 27 Dec 2020 17:20:15 -0700 Subject: [PATCH] doc: update emitClose default for fs streams The default for the `emitClose` option was changed from `false` to `true` by nodejs/node#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 PR-URL: https://github.com/nodejs/node/pull/36653 Reviewed-By: Rich Trott Reviewed-By: Robert Nagy --- doc/api/fs.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index f8d0fe7f5db8ed..8f896437d7438d 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1765,6 +1765,9 @@ changes: - v15.4.0 pr-url: https://github.com/nodejs/node/pull/35922 description: The `fd` option accepts FileHandle arguments. + - version: v14.0.0 + pr-url: https://github.com/nodejs/node/pull/31408 + description: Change `emitClose` default to `true`. - version: - v13.6.0 - v12.17.0 @@ -1799,7 +1802,7 @@ changes: * `fd` {integer|FileHandle} **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` @@ -1827,9 +1830,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, @@ -1876,6 +1879,9 @@ changes: - v15.4.0 pr-url: https://github.com/nodejs/node/pull/35922 description: The `fd` option accepts FileHandle arguments. + - version: v14.0.0 + pr-url: https://github.com/nodejs/node/pull/31408 + description: Change `emitClose` default to `true`. - version: - v13.6.0 - v12.17.0 @@ -1908,7 +1914,7 @@ changes: * `fd` {integer|FileHandle} **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][]. @@ -1925,9 +1931,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()`