doc: make writable.setDefaultEncoding()
return this
Let this function return `this` for parity with `readable.setEncoding()`. PR-URL: https://github.com/nodejs/node/pull/5040 Fixes: https://github.com/nodejs/node/issues/5013 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
62c31fe392
commit
bcce05dba4
@ -695,6 +695,7 @@ file.end('world!');
|
|||||||
#### writable.setDefaultEncoding(encoding)
|
#### writable.setDefaultEncoding(encoding)
|
||||||
|
|
||||||
* `encoding` {String} The new default encoding
|
* `encoding` {String} The new default encoding
|
||||||
|
* Return: `this`
|
||||||
|
|
||||||
Sets the default encoding for a writable stream.
|
Sets the default encoding for a writable stream.
|
||||||
|
|
||||||
|
@ -251,6 +251,7 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
|||||||
if (!Buffer.isEncoding(encoding))
|
if (!Buffer.isEncoding(encoding))
|
||||||
throw new TypeError('Unknown encoding: ' + encoding);
|
throw new TypeError('Unknown encoding: ' + encoding);
|
||||||
this._writableState.defaultEncoding = encoding;
|
this._writableState.defaultEncoding = encoding;
|
||||||
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
function decodeChunk(state, chunk, encoding) {
|
function decodeChunk(state, chunk, encoding) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user