streams emits string under load, usually its a buffer

28 views
Skip to first unread message

Derek Collison

unread,
Aug 4, 2015, 12:38:33 AM8/4/15
to nodejs
I am seeing weird behavior under load when a stream will emit a data event with a string when it normally hands me a buffer. Any ideas on this? 

Jimb Esser

unread,
Aug 4, 2015, 8:16:44 PM8/4/15
to nodejs
There is probably some internal buffering going on somewhere that is combining data together before emitting events (and, it probably only gets multiple chunks of data coming in at once under load).  Most stream modules probably expect the data coming in to be strings and do things like add them together, and typeof (new Buffer('a') + new Buffer('b')) = 'string'.
Reply all
Reply to author
Forward
0 new messages