hpack v2.0.0 HPack.Huffman

Huffman static table de/encoding as defined in RFC 7541.

Link to this section Summary

Functions

Decodes a Huffman encoded string with the HPACK static table.

Huffman encodes a string using the HPACK static table.

Link to this section Functions

Link to this function

decode(encoded)

decode(binary()) :: {:ok, String.t()} | {:error, :decode_error}

Decodes a Huffman encoded string with the HPACK static table.

Returns the decoded String.

Examples

iex> HPack.Huffman.decode(<< 0x27::6, 0x5::5, 0x28::6, 0x28::6, 0x7::5 >>)
{:ok, "hello"}
Link to this function

encode(string)

encode(String.t()) :: {:ok, binary()} | {:error, :encode_error}

Huffman encodes a string using the HPACK static table.

Returns the encoded String.

Examples

iex> HPack.Huffman.encode("hello")
{:ok, <<0x9c, 0xb4, 0x50, 0x7f>>}