Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WriteStream<T>

Represents a stream of data that can be written to.

Any class that implements this interface can be used by a Pipe to pipe data from a ReadStream to it.

Type parameters

  • T

Hierarchy

Implemented by

Index

Methods

drainHandler

  • drainHandler(handler: ((res: void) => void) | Handler<void> | null | undefined): WriteStream<T>
  • Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See Pipe for an example of this being used.

    The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to maxSize / 2.

    Parameters

    • handler: ((res: void) => void) | Handler<void> | null | undefined

    Returns WriteStream<T>

end

  • Same as {@link WriteStream#end} but with an handler called when the operation completes

    Returns PromiseLike<void>

  • Same as {@link WriteStream#end} but with an handler called when the operation completes

    Parameters

    Returns void

  • Same as but with an handler called when the operation completes

    Parameters

    • data: T

    Returns PromiseLike<void>

  • Same as but with an handler called when the operation completes

    Parameters

    Returns void

exceptionHandler

setWriteQueueMaxSize

  • setWriteQueueMaxSize(maxSize: number): WriteStream<T>
  • Set the maximum size of the write queue to maxSize. You will still be able to write to the stream even if there is more than maxSize items in the write queue. This is used as an indicator by classes such as Pipe to provide flow control.

    The value is defined by the implementation of the stream, e.g in bytes for a NetSocket, etc...

    Parameters

    • maxSize: number

    Returns WriteStream<T>

write

  • Same as but with an handler called when the operation completes

    Parameters

    • data: T

    Returns PromiseLike<void>

  • Same as but with an handler called when the operation completes

    Parameters

    Returns void

writeQueueFull

  • writeQueueFull(): boolean
  • This will return true if there are more bytes in the write queue than the value set using {@link WriteStream#setWriteQueueMaxSize}

    Returns boolean

Generated using TypeDoc