-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
- Version: 8.2.1
- Platform: Darwin
- Subsystem: stream
This need comes from the practice to use transform streams to perform pipeline processing with backpressure, in order to process incoming binary data, by splitting it to intermediate chunk objects. In such cases the transform stream will accept buffers as input (readableObjectMode: true) and push out objects (writableObjectMode: true), or vice versa.
While the objectMode flag supports separation between readable and writable, the highWaterMark option is unified between the stream roles, which doesn't allow to set the internal buffer size units with respect to the stream type. It seems that optional support for readableHighWaterMark and writableHighWaterMark is a natural complementary option to the separated readableObjectMode and writableObjectMode options.
If PR's are welcome I can code the same handling for in the ctors of Readable and Writable and add to docs.
LMK what you think,
Thanks!
References:
• https://nodejs.org/en/docs/guides/backpressuring-in-streams/
• https://github.com/nodejs/node/blob/master/lib/_stream_readable.js#L69