doc,fs: rename defaultEncoding option to encoding

The documentation for `fs.createWriteStream()` references a
`defaultEncoding` as possible options property, but in reality
`encoding` property is expected and properly handled. This fix updates
the documentation to rename the `defaultEncoding` property to
`encoding`.

PR-URL: https://github.com/nodejs/node/pull/14867
Fixes: https://github.com/nodejs/node/issues/14611
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Aleh Zasypkin 2017-08-16 19:32:54 +02:00 committed by Refael Ackermann
parent b9d63ab1b7
commit e96c11c384
No known key found for this signature in database
GPG Key ID: CD704BD80FDDDB64

View File

@ -835,7 +835,7 @@ changes:
* `path` {string|Buffer|URL} * `path` {string|Buffer|URL}
* `options` {string|Object} * `options` {string|Object}
* `flags` {string} * `flags` {string}
* `defaultEncoding` {string} * `encoding` {string}
* `fd` {integer} * `fd` {integer}
* `mode` {integer} * `mode` {integer}
* `autoClose` {boolean} * `autoClose` {boolean}
@ -848,7 +848,7 @@ Returns a new [`WriteStream`][] object. (See [Writable Stream][]).
```js ```js
const defaults = { const defaults = {
flags: 'w', flags: 'w',
defaultEncoding: 'utf8', encoding: 'utf8',
fd: null, fd: null,
mode: 0o666, mode: 0o666,
autoClose: true autoClose: true
@ -858,7 +858,7 @@ const defaults = {
`options` may also include a `start` option to allow writing data at `options` may also include a `start` option to allow writing data at
some position past the beginning of the file. Modifying a file rather some position past the beginning of the file. Modifying a file rather
than replacing it may require a `flags` mode of `r+` rather than the than replacing it may require a `flags` mode of `r+` rather than the
default mode `w`. The `defaultEncoding` can be any one of those accepted by default mode `w`. The `encoding` can be any one of those accepted by
[`Buffer`][]. [`Buffer`][].
If `autoClose` is set to true (default behavior) on `error` or `end` If `autoClose` is set to true (default behavior) on `error` or `end`