Skip to content


Subversion checkout URL

You can clone with
Download ZIP


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

chbrown opened this Issue · 2 comments

2 participants


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 for MWE.


@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.


@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.