diff --git a/doc/api/stream.md b/doc/api/stream.md index 14724e8311a45f..2bde10c1fefe65 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1652,8 +1652,7 @@ const { StringDecoder } = require('string_decoder'); class StringWritable extends Writable { constructor(options) { super(options); - const state = this._writableState; - this._decoder = new StringDecoder(state.defaultEncoding); + this._decoder = new StringDecoder(options && options.defaultEncoding); this.data = ''; } _write(chunk, encoding, callback) {