OutgoingMessage is missing _writableState. More of a consistency issue. Not sure what the current plan is in regards to _readableState and _writableState. However, some user land modules seem to assume they exists.
Please keep in mind that both _readableState and _writeableState are internal properties and you _shouldn't_ use or rely on them in any way. There has been quite a bit of heavy refactoring on master regarding the two, and I won't be surprised if they started disappearing from places.
/cc @nodejs/streams @mcollina @mafintosh
Please keep in mind that both _readableState and _writeableState are internal properties and you shouldn't use or rely on them in any way.
I am aware of this. However, a lot of popular packages seem to make assumptions in regards to this. I remember this being discussed a long time ago, just not sure what the consensus was. I believe these were going to be made public?
I do not have a paper trail, it's buried in our issue tracker. The gist is that OutgoingMessage is not a Writable, it just _quacks_ like one. The main reason for this is performance: if we made it a full writable we would lose a significant amount of throughput. OutgoingMessage does not buffer any data internally, it just forwards it to the underlining stream as fast as it can.
The overall plan is to remove the use of _readableState and _writableState across core codebase: https://github.com/nodejs/node/issues/445. We are doing this by creating accessors. Ideally those accessors could be added to OutgoingMessage, so that they can have the same interface and guarantees.
I think this issue can be closed. Feel free to open new issues for missing accessor/etc in OutgoingMessage.
Most helpful comment
I do not have a paper trail, it's buried in our issue tracker. The gist is that
OutgoingMessageis not aWritable, it just _quacks_ like one. The main reason for this is performance: if we made it a full writable we would lose a significant amount of throughput.OutgoingMessagedoes not buffer any data internally, it just forwards it to the underlining stream as fast as it can.The overall plan is to remove the use of
_readableStateand_writableStateacross core codebase: https://github.com/nodejs/node/issues/445. We are doing this by creating accessors. Ideally those accessors could be added toOutgoingMessage, so that they can have the same interface and guarantees.