mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
0d1985358a
commit
e6c8da45b1
2 files changed
+2
No files matched your search
@@ -695,6 +695,7 @@ file.end('world!');
|
||||
#### writable.setDefaultEncoding(encoding)
|
||||
|
||||
* `encoding` {String} The new default encoding
|
||||
* Return: `this`
|
||||
|
||||
Sets the default encoding for a writable stream.
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
||||
if (!Buffer.isEncoding(encoding))
|
||||
throw new TypeError('Unknown encoding: ' + encoding);
|
||||
this._writableState.defaultEncoding = encoding;
|
||||
return this;
|
||||
};
|
||||
|
||||
function decodeChunk(state, chunk, encoding) {
|
||||
|
||||
Reference in new issue
Block a user