You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a meta-issue to keep to track of all usages of _writableState and _readableState outside of streams source. These properties are considered private and should not be used unless absolutely necessary. Usage of them can indicate a few things:
the code can be rewritten using existing documented API to achieve the same result;
streams lack some consumer functionality and new public API should be introduced;
streams lack some implementor functionality and new protected API should be introduced;
documentation needs to be added for some parts of private state for implementors;
it is an optimization that is and always be possible only in core.
The list of all _writableState and _readableState usages:
L348socket._readableState.flowing = null (TODO(isaacs): Need a way to reset a stream to fresh state IE, not flowing, and not explicitly paused.). Added in 967b5db by @isaacs;
L408var needPause = socket._writableState.needDrain. Added in 085dd30 by @isaacs ;
L445req._readableState.resumeScheduled. Not sure where this originated, but in 2efe4ab@indutny added oldMode check here;
whole LazyTransform thing. Is it really necessary? Maybe it should go to stream? Maybe it should be public? Maybe transforms should be lazy by default?;
L242 this._readableState.ended = true (comment: ended should already be true, since this is called after the EOF errno and onread has eof'ed) (Cleanup stream state in net #465);
flowing (boolean?) is used to determine which mode readable stream is in; can be true, false or null; `null is the initial state which means that is implicitly paused;
This is a meta-issue to keep to track of all usages of
_writableStateand_readableStateoutside of streams source. These properties are considered private and should not be used unless absolutely necessary. Usage of them can indicate a few things:The list of all
_writableStateand_readableStateusages:src/node.jsstdin._readableState.reading = false. Added in commit: bb56dcc by @isaacs; (src: nix stdin _readableState.reading manipulation #454)stdin._readableState.reading = false. Added in commit: bb56dcc by @isaacs; (src: nix stdin _readableState.reading manipulation #454)lib/_debug_agent.jsthis._readableState.objectMode = true(_debug_agent: usereadableObjectModeoption for client stream #270);lib/_http_server.jssocket._readableState.flowing = null(TODO(isaacs): Need a way to reset a stream to fresh state IE, not flowing, and not explicitly paused.). Added in 967b5db by @isaacs;var needPause = socket._writableState.needDrain. Added in 085dd30 by @isaacs ;req._readableState.resumeScheduled. Not sure where this originated, but in 2efe4ab @indutny addedoldModecheck here;lib/_tls_legacy.jsthis._writableState.finished;self._readableState.length > 0;lib/_tls_wrap.jsself._writableState.errorEmitted(Cleanup stream state in net #465);self._writableState.errorEmitted = true(Cleanup stream state in net #465);socket._readableState.length;lib/child_process.jsstream._readableState.flowing(child_process: remove redundant condition #511);lib/crypto.jsLazyTransformthing. Is it really necessary? Maybe it should go tostream? Maybe it should be public? Maybe transforms should be lazy by default?;this._writableState.decodeStrings = false;this._writableState.defaultEncoding = 'binary';var encoding = this._readableState.encoding || 'buffer'(crypto: remove use of this._readableState #610);lib/fs.jsallocNewPool(this._readableState.highWaterMark);lib/net.jsthis._writableState.decodeStrings = false(Cleanup stream state in net #465);this._readableState.flowing = false(Cleanup stream state in net #465);this._readableState.ended(Cleanup stream state in net #465);self._readableState.ended;this._readableState.ended = true(comment: ended should already be true, since this is called after the EOF errno and onread has eof'ed) (Cleanup stream state in net #465);this._readableState.endEmitted;this._writableState.length;this._readableState.endEmitted;socket._writableState.length;if (this._writableState.finished);self._writableState.errorEmitted(Cleanup stream state in net #465);self._writableState.errorEmitted = true(Cleanup stream state in net #465);self._readableState.length === 0;state.getBuffer();this._readableState.reading = false;this._readableState.ended = false;this._readableState.endEmitted = false;this._writableState.ended = false;this._writableState.ending = false;this._writableState.finished = false;this._writableState.errorEmitted = false(Cleanup stream state in net #465);lib/zlib.jsws.ended;ws.ending;ws.needDrain;ws.ending || ws.ended;ws.length;ws.length.List of used properties:
_readableStatereading;objectMode;flowing(boolean?) is used to determine which mode readable stream is in; can betrue,falseornull; `null is the initial state which means that is implicitly paused;resumeScheduled;length;encoding;highWaterMark;ended;endEmitted;_writableStateneedDrain;ended;ending;finished;errorEmitted;decodeStrings;defaultEncoding;length;getBuffer();/cc @chrisdickinson