TON SDK Documentation - v15.3.1duck0.0.3
    Preparing search index...

    Class BitString

    BitString is a class that represents a bitstring in a buffer with a specified offset and length

    Index

    Constructors

    • Constructing BitString from a buffer

      Parameters

      • data: Buffer

        data that contains the bitstring data. NOTE: We are expecting this buffer to be NOT modified

      • offset: number

        offset in bits from the start of the buffer

      • length: number

        length of the bitstring in bits

      Returns BitString

    Properties

    "[SymbolInspect]": () => string
    EMPTY: BitString

    Accessors

    • get length(): number

      Returns the length of the bitstring

      Returns number

    Methods

    • Returns the bit at the specified index

      Parameters

      • index: number

        index of the bit

      Returns boolean

      true if the bit is set, false otherwise

      Error if index is out of bounds

    • Checks for equality

      Parameters

      Returns boolean

      true if the bitstrings are equal, false otherwise

    • Try to get a buffer from the bitstring without allocations

      Parameters

      • offset: number

        offset in bits

      • length: number

        length in bits

      Returns null | Buffer

      buffer if the bitstring is aligned to bytes, null otherwise

    • Get a subscring of the bitstring

      Parameters

      • offset: number
      • length: number

      Returns BitString

    • Format to canonical string

      Returns string

      formatted bits as a string

    • Checks if supplied object is BitString

      Parameters

      • src: unknown

        is unknow object

      Returns src is BitString

      true if object is BitString and false otherwise