Skip to content

doc: fix trivial mistakes in stream document.

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

1st commit: In stream.Writable, when decodeStrings option is false, the chunk _write() function received is not always be Buffer, it depends types of the sources.

const {Writable} = require('stream');
class MyWritable extends Writable {
  _write(chunk, enc, cb) {
    console.log(chunk);
    console.log('typeof chunk : ' + typeof chunk);
    cb();
  }
}

const w = new MyWritable({decodeStrings: false});
w.write('abc');
w.write(Buffer.from('abc'));

// => abc
// => typeof chunk : string
// => <Buffer 61 62 63>
// => typeof chunk : object

2nd commit: This is a trivial fix, 'unexpected' fits this context.

Merge request reports

Loading