Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataAndMoneyStream

Hierarchy

  • Duplex
    • DataAndMoneyStream

Implements

  • ReadableStream
  • Writable

Constructors

constructor

Properties

Optional Private _errorMessage

_errorMessage: undefined | string

Private _remoteClosed

_remoteClosed: boolean

Private _remoteMaxOffset

_remoteMaxOffset: number

Private _remoteReceiveMax

_remoteReceiveMax: Long

Private _remoteReceived

_remoteReceived: Long

Private _remoteSentEnd

_remoteSentEnd: boolean

Private _sentEnd

_sentEnd: boolean

id

id: number

readable

readable: boolean

writable

writable: boolean

Static defaultMaxListeners

defaultMaxListeners: number

Accessors

readableHighWaterMark

readableHighWaterMark:

Returns the value of readableHighWaterMark passed when constructing this stream

This property exists on streams after Node 8.10 so it is added here for backwards compatibility

This property exists on streams after Node 8.10 so it is added here for backwards compatibility

readableLength

readableLength:

Number of bytes buffered and waiting to be read

This property exists on streams after Node 9.4 so it is added here for backwards compatibility

This property exists on streams after Node 9.4 so it is added here for backwards compatibility

receipt

receipt:

Latest receipt for total sent amount.

receiveMax

receiveMax:

The current limit up to which the stream will try to receive, denominated in the connection plugin's units. (If the receiveMax is greater than the totalReceived, the stream will continue to receive money when the other side sends it)

sendMax

sendMax:

The current limit up to which the stream will try to send, denominated in the connection plugin's units. (If the sendMax is greater than the totalSent, the stream will continue to send the difference)

totalReceived

totalReceived:

Total amount received so far, denominated in the connection plugin's units.

totalSent

totalSent:

Total amount sent so far, denominated in the connection plugin's units.

writableHighWaterMark

writableHighWaterMark:

Returns the value of writableHighWaterMark passed when constructing this stream

This property exists on streams after Node 8.10 so it is added here for backwards compatibility

This property exists on streams after Node 8.10 so it is added here for backwards compatibility

writableLength

writableLength:

Number of bytes buffered and waiting to be sent

This property exists on streams after Node 9.4 so it is added here for backwards compatibility

This property exists on streams after Node 9.4 so it is added here for backwards compatibility

Methods

__@asyncIterator

  • __@asyncIterator(): AsyncIterableIterator<any>
  • Returns AsyncIterableIterator<any>

Private _addToIncoming

  • _addToIncoming(amount: Long, prepare: IlpPrepare): void
  • (Internal) Add money to the stream (from an external source) (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • amount: Long
    • prepare: IlpPrepare

    Returns void

Private _cancelHold

  • _cancelHold(holdId: string): void
  • (Internal) Cancel hold if sending money failed (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • holdId: string

    Returns void

Private _destroy

  • _destroy(error: Error | undefined | null, callback: function): void
  • (Called internally by the Node Stream when stream.destroy is called)

    Parameters

    • error: Error | undefined | null
    • callback: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns void

Private _executeHold

  • _executeHold(holdId: string): void
  • (Internal) Execute hold when money has been successfully transferred (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • holdId: string

    Returns void

Private _final

  • _final(callback: function): void
  • (Called internally by the Node Stream when the stream ends)

    Parameters

    • callback: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns void

Private _getAmountAvailableToSend

  • _getAmountAvailableToSend(): Long
  • (Internal) Check how much is available to send (Used by the Connection class but not meant to be part of the public API)

    Returns Long

Private _getAmountStreamCanReceive

  • _getAmountStreamCanReceive(): Long
  • (Internal) Determine how much more the stream can receive (Used by the Connection class but not meant to be part of the public API)

    Returns Long

Private _getAvailableDataToSend

  • _getAvailableDataToSend(size: number): object
  • (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • size: number

    Returns object

    • data: Buffer | undefined
    • offset: number

Private _getIncomingOffsets

  • _getIncomingOffsets(): object
  • (Used by the Connection class but not meant to be part of the public API)

    Returns object

    • current: number
    • max: number
    • maxAcceptable: number

Private _getOutgoingOffsets

  • _getOutgoingOffsets(): object
  • (Used by the Connection class but not meant to be part of the public API)

    Returns object

    • current: number
    • max: number

Private _hasDataToSend

  • _hasDataToSend(): boolean
  • (Used by the Connection class but not meant to be part of the public API)

    Returns boolean

Private _holdOutgoing

  • _holdOutgoing(holdId: string, maxAmount: Long): Long
  • (Internal) Hold outgoing balance (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • holdId: string
    • Optional maxAmount: Long

    Returns Long

Private _isDataBlocked

  • _isDataBlocked(): number | undefined
  • (Used by the Connection class but not meant to be part of the public API)

    Returns number | undefined

Private _pushIncomingData

  • _pushIncomingData(data: Buffer, offset: number): void
  • (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • data: Buffer
    • offset: number

    Returns void

Private _read

  • _read(size: number): void
  • (Called internally by the Node Stream when stream.read is called)

    Parameters

    • size: number

    Returns void

Private _remoteEnded

  • _remoteEnded(err: Error): void
  • (Used by the Connection class but not meant to be part of the public API)

    Parameters

    Returns void

Private _resendOutgoingData

  • _resendOutgoingData(data: Buffer, offset: number): void
  • (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • data: Buffer
    • offset: number

    Returns void

Private _setReceipt

  • _setReceipt(receipt: Buffer): void
  • (Used by the Connection class but not meant to be part of the public API)

    Parameters

    • receipt: Buffer

    Returns void

Private _write

  • _write(chunk: Buffer, encoding: string, callback: function): void
  • (Called internally by the Node Stream when stream.write is called)

    Parameters

    • chunk: Buffer
    • encoding: string
    • callback: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns void

Private _writev

  • _writev(chunks: object[], callback: function): void
  • (Called internally by the Node Stream when stream.write is called)

    Parameters

    • chunks: object[]
    • callback: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns void

addListener

  • addListener(event: "close", listener: function): this
  • addListener(event: "data", listener: function): this
  • addListener(event: "end", listener: function): this
  • addListener(event: "readable", listener: function): this
  • addListener(event: "error", listener: function): this
  • addListener(event: string | symbol, listener: function): this
  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

cork

  • cork(): void
  • Returns void

destroy

  • destroy(error: Error): void
  • Parameters

    Returns void

emit

  • emit(event: "close"): boolean
  • emit(event: "data", chunk: any): boolean
  • emit(event: "end"): boolean
  • emit(event: "readable"): boolean
  • emit(event: "error", err: Error): 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: "readable"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

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

    Returns boolean

end

  • end(cb: undefined | function): void
  • end(chunk: any, cb: undefined | function): void
  • end(chunk: any, encoding: undefined | string, cb: undefined | function): void
  • Parameters

    • Optional cb: undefined | function

    Returns void

  • Parameters

    • chunk: any
    • Optional cb: undefined | function

    Returns void

  • Parameters

    • chunk: any
    • Optional encoding: undefined | string
    • Optional cb: undefined | function

    Returns void

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

isOpen

  • isOpen(): boolean
  • Returns true if the stream is open for sending and/or receiving.

    Returns boolean

isPaused

  • isPaused(): boolean
  • Returns boolean

listenerCount

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

    • type: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

on

  • on(event: "close", listener: function): this
  • on(event: "data", listener: function): this
  • on(event: "end", listener: function): this
  • on(event: "readable", listener: function): this
  • on(event: "error", listener: function): this
  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

once

  • once(event: "close", listener: function): this
  • once(event: "data", listener: function): this
  • once(event: "end", listener: function): this
  • once(event: "readable", listener: function): this
  • once(event: "error", listener: function): this
  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

pause

  • pause(): this
  • Returns this

pipe

  • pipe<T>(destination: T, options: undefined | object): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: undefined | object

    Returns T

prependListener

  • prependListener(event: "close", listener: function): this
  • prependListener(event: "data", listener: function): this
  • prependListener(event: "end", listener: function): this
  • prependListener(event: "readable", listener: function): this
  • prependListener(event: "error", listener: function): this
  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: "close", listener: function): this
  • prependOnceListener(event: "data", listener: function): this
  • prependOnceListener(event: "end", listener: function): this
  • prependOnceListener(event: "readable", listener: function): this
  • prependOnceListener(event: "error", listener: function): this
  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

push

  • push(chunk: any, encoding: undefined | string): boolean
  • Parameters

    • chunk: any
    • Optional encoding: undefined | string

    Returns boolean

rawListeners

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

    • event: string | symbol

    Returns Function[]

read

  • read(size: undefined | number): any
  • Parameters

    • Optional size: undefined | number

    Returns any

receiveTotal

  • receiveTotal(_limit: LongValue, opts: ReceiveOpts): Promise<void>
  • Set the total amount the stream will receive and wait for that amount to be received. Note that this is absolute, not relative so calling receiveTotal(100) twice will only receive 100 units.

    This promise will only resolve when the absolute amount specified is reached, so lowering the receiveMax may cause this not to resolve.

    This promise will only resolve when the absolute amount specified is reached, so lowering the receiveMax may cause this not to resolve.

    Parameters

    Returns Promise<void>

removeAllListeners

  • removeAllListeners(event: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: "close", listener: function): this
  • removeListener(event: "data", listener: function): this
  • removeListener(event: "end", listener: function): this
  • removeListener(event: "readable", listener: function): this
  • removeListener(event: "error", listener: function): this
  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • chunk: any

          Returns void

    Returns this

  • Parameters

    • event: "end"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "readable"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

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

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: function
        • (args: any[]): void
        • Parameters

          • Rest args: any[]

          Returns void

    Returns this

resume

  • resume(): this
  • Returns this

sendTotal

  • sendTotal(_limit: LongValue, opts: SendOpts): Promise<void>
  • Set the total amount the stream will send and wait for that amount to be sent. Note that this is absolute, not relative so calling sendTotal(100) twice will only send 100 units.

    This promise will only resolve when the absolute amount specified is reached, so lowering the sendMax may cause this not to resolve.

    This promise will only resolve when the absolute amount specified is reached, so lowering the sendMax may cause this not to resolve.

    Parameters

    • _limit: LongValue
    • Optional opts: SendOpts

    Returns Promise<void>

setDefaultEncoding

  • setDefaultEncoding(encoding: string): this
  • Parameters

    • encoding: string

    Returns this

setEncoding

  • setEncoding(encoding: string): this
  • Parameters

    • encoding: string

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

setReceiveMax

  • setReceiveMax(limit: LongValue): void
  • Set the total amount this stream will receive, denominated in the connection plugin's units. Note that this is absolute, not relative so calling setReceiveMax(100) twice will only let the stream receive 100 units.

    fires

    money

    Parameters

    • limit: LongValue

    Returns void

setSendMax

  • setSendMax(limit: LongValue): void
  • Set the total amount this stream will send, denominated in the connection plugin's units. Note that this is absolute, not relative so calling setSendMax(100) twice will only send 100 units.

    Parameters

    • limit: LongValue

    Returns void

uncork

  • uncork(): void
  • Returns void

unpipe

  • unpipe(destination: NodeJS.WritableStream): this
  • Parameters

    • Optional destination: NodeJS.WritableStream

    Returns this

unshift

  • unshift(chunk: any): void
  • Parameters

    • chunk: any

    Returns void

wrap

  • wrap(oldStream: ReadableStream): this
  • Parameters

    • oldStream: ReadableStream

    Returns this

write

  • write(chunk: any, cb: undefined | function): boolean
  • write(chunk: any, encoding: undefined | string, cb: undefined | function): boolean
  • Parameters

    • chunk: any
    • Optional cb: undefined | function

    Returns boolean

  • Parameters

    • chunk: any
    • Optional encoding: undefined | string
    • Optional cb: undefined | function

    Returns boolean

Static listenerCount

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

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc