mwg API
    Preparing search index...

    Function huffDecode

    • The inverse of huffEncode: throws on malformed input rather than guessing, because a corrupt table must fail the load, never misprobe. The symbol count in the header must match the decoded symbols exactly, so truncation fails here instead of probing short.

      Parameters

      • code: string

      Returns Uint8Array

      import { huffDecode, huffEncode } from '@datamoc/mwg/board';

      console.log(huffDecode(huffEncode(new Uint8Array([2, 2])))); // Uint8Array([2, 2])