Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

decodeStrings ignored when objectMode = true in stream.Writable #5580

Closed
chbrown opened this Issue · 2 comments

2 participants

@chbrown

This is particularly unexpected with stream.Transform({decodeStrings: true, objectMode: true}), because in _transform(chunk, ...), chunk is sometimes a string.
Apparently objectMode trickles down into the Writable, and overrides the decodeStrings setting, but I only want it to apply to the Readable side, which is what I expected, since Writable's objectMode is undocumented.
I make it behave as expected by setting this._writableState.objectMode = false; in my Transform's constructor.

See https://gist.github.com/chbrown/5665509 for MWE.

@jasnell
Owner

@chbrown ... I know it's been a while, but is this still an issue for you. It's not clear from the sample case you provided.

@chbrown

@jasnell yeah kind of forgot about this issue — so I guess it really isn't one. stream.Transform is a tricky thing — double inheritance in Javascript's prototype paradigm. After reading through the node/lib/_stream_transform.js and node/lib/_stream_writable.js source, it makes sense. IIRC, my solution remains (setting this._writableState.objectMode directly), but I can see why I need to do that now.

@chbrown chbrown closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.