Options
All
  • Public
  • Public/Protected
  • All
Menu

Module read

Index

Functions

Functions

_consumeType

  • _consumeType(typeBuffer: ArrayBuffer, offset: number): ReadResult<Type<unknown>>
  • Parameters

    • typeBuffer: ArrayBuffer
    • offset: number

    Returns ReadResult<Type<unknown>>

type

  • type(typeBuffer: ArrayBuffer | Uint8Array, fullBuffer?: boolean): Type<unknown>
  • Deserializes a type, i.e. takes a buffer containing its binary form and creates the type object. The inverse of calling Type.toBuffer.

    Example:

    let type = new sb.ArrayType(
      new sb.FlexUnsignedIntType
    )
    let typeBuffer = type.toBuffer()
    let readType = sb.r.type(typeBuffer)
    console.log(readType) // ArrayType { type: FlexUnsignedIntType {} }
    

    Parameters

    • typeBuffer: ArrayBuffer | Uint8Array

      The buffer containing the type bytes

    • fullBuffer: boolean = true

      Whether to assert that the whole buffer was read. In most use cases, this argument should be be omitted.

    Returns Type<unknown>

    The type that was read

Generated using TypeDoc