Skip to content

Duplex stream support for separate readableHighWaterMark and writableHighWaterMark #14555

@guymguym

Description

@guymguym
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions