Function binStringToBin

  • Decode a binary-encoded string into a Uint8Array.

    E.g.: binStringToBin('0010101001100100')new Uint8Array([42, 100])

    Note, this method always completes. If binaryDigits is not divisible by 8, the final byte will be parsed as if it were prepended with 0s (e.g. 1 is interpreted as 00000001). If binaryDigits is potentially malformed, check it with isBinString before calling this method.

    For the reverse, see binToBinString.

    Parameters

    • binaryDigits: string

      a string of 0s and 1s with a length divisible by 8

    Returns Uint8Array

Generated using TypeDoc