Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MessageStream

A duplex stream that is capable of reading and writing raw wire protocol messages, with support for optional compression

internal

Hierarchy

  • Duplex
    • MessageStream

Index

Constructors

constructor

Properties

[kBuffer]

[kBuffer]: BufferPool
internal

destroyed

destroyed: boolean

maxBsonMessageSize

maxBsonMessageSize: number
internal

readable

readable: boolean

Readonly readableEncoding

readableEncoding: null | BufferEncoding

Readonly readableEnded

readableEnded: boolean

Readonly readableFlowing

readableFlowing: null | boolean

Readonly readableHighWaterMark

readableHighWaterMark: number

Readonly readableLength

readableLength: number

Readonly readableObjectMode

readableObjectMode: boolean

Readonly writable

writable: boolean

Readonly writableCorked

writableCorked: number

Readonly writableEnded

writableEnded: boolean

Readonly writableFinished

writableFinished: boolean

Readonly writableHighWaterMark

writableHighWaterMark: number

Readonly writableLength

writableLength: number

Readonly writableObjectMode

writableObjectMode: boolean

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

[asyncIterator]

  • [asyncIterator](): AsyncIterableIterator<any>
  • Returns AsyncIterableIterator<any>

Optional _construct

  • _construct(callback: (error?: null | Error) => void): void
  • Parameters

    • callback: (error?: null | Error) => void
        • (error?: null | Error): void
        • Parameters

          • Optional error: null | Error

          Returns void

    Returns void

_destroy

  • _destroy(error: null | Error, callback: (error: null | Error) => void): void
  • Parameters

    • error: null | Error
    • callback: (error: null | Error) => void
        • (error: null | Error): void
        • Parameters

          • error: null | Error

          Returns void

    Returns void

_final

  • _final(callback: (error?: null | Error) => void): void
  • Parameters

    • callback: (error?: null | Error) => void
        • (error?: null | Error): void
        • Parameters

          • Optional error: null | Error

          Returns void

    Returns void

_read

  • _read(): void

_write

  • _write(chunk: Buffer, _: unknown, callback: Callback<Buffer>): void

Optional _writev

  • _writev(chunks: { chunk: any; encoding: BufferEncoding }[], callback: (error?: null | Error) => void): void
  • Parameters

    • chunks: { chunk: any; encoding: BufferEncoding }[]
    • callback: (error?: null | Error) => void
        • (error?: null | Error): void
        • Parameters

          • Optional error: null | Error

          Returns void

    Returns void

addListener

  • addListener(event: "close", listener: () => void): MessageStream
  • addListener(event: "data", listener: (chunk: any) => void): MessageStream
  • addListener(event: "end", listener: () => void): MessageStream
  • addListener(event: "error", listener: (err: Error) => void): MessageStream
  • addListener(event: "pause", listener: () => void): MessageStream
  • addListener(event: "readable", listener: () => void): MessageStream
  • addListener(event: "resume", listener: () => void): MessageStream
  • addListener(event: string | symbol, listener: (...args: any[]) => void): MessageStream
  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. error
    5. pause
    6. readable
    7. resume

    Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

cork

  • cork(): void
  • Returns void

destroy

  • destroy(error?: Error): void
  • Parameters

    • Optional error: Error

    Returns void

emit

  • emit(event: "close"): boolean
  • emit(event: "data", chunk: any): boolean
  • emit(event: "end"): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "pause"): boolean
  • emit(event: "readable"): boolean
  • emit(event: "resume"): boolean
  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "data"
    • chunk: any

    Returns boolean

  • Parameters

    • event: "end"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "pause"

    Returns boolean

  • Parameters

    • event: "readable"

    Returns boolean

  • Parameters

    • event: "resume"

    Returns boolean

  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

end

  • end(cb?: () => void): void
  • end(chunk: any, cb?: () => void): void
  • end(chunk: any, encoding?: BufferEncoding, cb?: () => void): void
  • Parameters

    • Optional cb: () => void
        • (): void
        • Returns void

    Returns void

  • Parameters

    • chunk: any
    • Optional cb: () => void
        • (): void
        • Returns void

    Returns void

  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding
    • Optional cb: () => void
        • (): void
        • Returns void

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

isPaused

  • isPaused(): boolean
  • Returns boolean

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): MessageStream
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

on

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

once

  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

pause

  • Returns MessageStream

pipe

  • pipe<T>(destination: T, options?: { end?: boolean }): T
  • Type parameters

    • T: WritableStream<T>

    Parameters

    • destination: T
    • Optional options: { end?: boolean }
      • Optional end?: boolean

    Returns T

prependListener

  • prependListener(event: "close", listener: () => void): MessageStream
  • prependListener(event: "data", listener: (chunk: any) => void): MessageStream
  • prependListener(event: "end", listener: () => void): MessageStream
  • prependListener(event: "error", listener: (err: Error) => void): MessageStream
  • prependListener(event: "pause", listener: () => void): MessageStream
  • prependListener(event: "readable", listener: () => void): MessageStream
  • prependListener(event: "resume", listener: () => void): MessageStream
  • prependListener(event: string | symbol, listener: (...args: any[]) => void): MessageStream
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

prependOnceListener

  • prependOnceListener(event: "close", listener: () => void): MessageStream
  • prependOnceListener(event: "data", listener: (chunk: any) => void): MessageStream
  • prependOnceListener(event: "end", listener: () => void): MessageStream
  • prependOnceListener(event: "error", listener: (err: Error) => void): MessageStream
  • prependOnceListener(event: "pause", listener: () => void): MessageStream
  • prependOnceListener(event: "readable", listener: () => void): MessageStream
  • prependOnceListener(event: "resume", listener: () => void): MessageStream
  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): MessageStream
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

push

  • push(chunk: any, encoding?: BufferEncoding): boolean
  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding

    Returns boolean

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

read

  • read(size?: number): any
  • Parameters

    • Optional size: number

    Returns any

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns MessageStream

removeListener

  • removeListener(event: "close", listener: () => void): MessageStream
  • removeListener(event: "data", listener: (chunk: any) => void): MessageStream
  • removeListener(event: "end", listener: () => void): MessageStream
  • removeListener(event: "error", listener: (err: Error) => void): MessageStream
  • removeListener(event: "pause", listener: () => void): MessageStream
  • removeListener(event: "readable", listener: () => void): MessageStream
  • removeListener(event: "resume", listener: () => void): MessageStream
  • removeListener(event: string | symbol, listener: (...args: any[]) => void): MessageStream
  • Parameters

    • event: "close"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "data"
    • listener: (chunk: any) => void
        • (chunk: any): void
        • Parameters

          • chunk: any

          Returns void

    Returns MessageStream

  • Parameters

    • event: "end"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "error"
    • listener: (err: Error) => void
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns MessageStream

  • Parameters

    • event: "pause"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "readable"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: "resume"
    • listener: () => void
        • (): void
        • Returns void

    Returns MessageStream

  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns MessageStream

resume

  • Returns MessageStream

setDefaultEncoding

  • Parameters

    • encoding: BufferEncoding

    Returns MessageStream

setEncoding

  • Parameters

    • encoding: BufferEncoding

    Returns MessageStream

setMaxListeners

  • Parameters

    • n: number

    Returns MessageStream

uncork

  • uncork(): void
  • Returns void

unpipe

  • Parameters

    • Optional destination: WritableStream

    Returns MessageStream

unshift

  • unshift(chunk: any, encoding?: BufferEncoding): void
  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding

    Returns void

wrap

  • Parameters

    • oldStream: ReadableStream

    Returns MessageStream

write

  • write(chunk: any, encoding?: BufferEncoding, cb?: (error: undefined | null | Error) => void): boolean
  • write(chunk: any, cb?: (error: undefined | null | Error) => void): boolean
  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding
    • Optional cb: (error: undefined | null | Error) => void
        • (error: undefined | null | Error): void
        • Parameters

          • error: undefined | null | Error

          Returns void

    Returns boolean

  • Parameters

    • chunk: any
    • Optional cb: (error: undefined | null | Error) => void
        • (error: undefined | null | Error): void
        • Parameters

          • error: undefined | null | Error

          Returns void

    Returns boolean

writeCommand

Static from

  • from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable
  • A utility method for creating Readable Streams out of iterators.

    Parameters

    • iterable: Iterable<any> | AsyncIterable<any>
    • Optional options: ReadableOptions

    Returns Readable

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters

    • emitter: DOMEventTarget | EventEmitter
    • name: string | symbol

    Returns Function[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc