Class Parser

helper to read in Duplex stream

Hierarchy

  • Parser

Constructors

Properties

ended: boolean = false
lastMessage: string = ''
stream: Duplex

Methods

  • read and drop all remaining data in stream

    Returns

    Returns Promise<true>

  • Parameters

    • howMany: number

    Returns Promise<string>

  • pipe howMany bytes to targetStream

    Returns

    Promise that resolves when all bytes are transferred

    Parameters

    • howMany: number

      bytes to transfer

    • targetStream: Duplex

      destination stream

    Returns Promise<void>

  • Parameters

    • howMany: number

    Returns Promise<Buffer>

  • should read code or failed the correct fail exception will be thow in case of error.

    Parameters

    • Rest ...codes: string[]

      the expected 4 char code to read

    Returns Promise<string>

  • read socket until \r\n

    Returns

    Parameters

    • Optional encoding: BufferEncoding

    Returns Promise<string>

  • read stream byte per byte until a delimiter is found

    Returns

    buffer wothout delimiter

    Parameters

    • code: number

      delimiter

    Returns Promise<Buffer>

  • Returns

    read a 4-ASCII digits length-prefixed data block

    Returns Promise<Buffer>

  • Parameters

    • encoding: BufferEncoding

    Returns Promise<string>

  • Parameters

    • re: RegExp

    Returns Promise<RegExpExecArray>

Generated using TypeDoc