Turns a node-datachannel DataChannel into a real Node.js stream, complete with buffering, backpressure (up to a point - if the buffer fills up, messages are dropped), and support for piping data elsewhere.

Read & written data may be either UTF-8 strings or Buffers - this difference exists at the protocol level, and is preserved here throughout.

Hierarchy

  • Duplex
    • DataChannelStream

Constructors

Accessors

Constructors

  • Parameters

    • rawChannel: DataChannel
    • streamOptions: {
          allowHalfOpen?: boolean;
          readableHighWaterMark?: number;
          writableHighWaterMark?: number;
      } = {}
      • OptionalallowHalfOpen?: boolean
      • OptionalreadableHighWaterMark?: number
      • OptionalwritableHighWaterMark?: number

    Returns DataChannelStream

Accessors