Skip to content

Commit e6c8da4

Browse files
estliberitasFishrock123
authored andcommitted
doc: make writable.setDefaultEncoding() return this
Let this function return `this` for parity with `readable.setEncoding()`. PR-URL: #5040 Fixes: #5013 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Calvin Metcalf <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 0d19853 commit e6c8da4

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

doc/api/stream.md

+1
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,7 @@ file.end('world!');
695695
#### writable.setDefaultEncoding(encoding)
696696

697697
* `encoding` {String} The new default encoding
698+
* Return: `this`
698699

699700
Sets the default encoding for a writable stream.
700701

lib/_stream_writable.js

+1
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
251251
if (!Buffer.isEncoding(encoding))
252252
throw new TypeError('Unknown encoding: ' + encoding);
253253
this._writableState.defaultEncoding = encoding;
254+
return this;
254255
};
255256

256257
function decodeChunk(state, chunk, encoding) {

0 commit comments

Comments
 (0)