Conduit v0.1.1 Conduit.Encoding.GZip

Handles encoding a message body to and from gzip.

Summary

Functions

Decodes the message body from gzip and sets the content encoding

Encodes the message body to gzip and sets the content encoding

Functions

decode(message, opts)

Decodes the message body from gzip and sets the content encoding.

Examples

iex> import Conduit.Message
iex> message =
iex>   %Conduit.Message{}
iex>   |> put_body(<<31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 171, 174, 5, 0, 67, 191, 166, 163, 2, 0, 0, 0>>)
iex>   |> Conduit.Encoding.GZip.decode([])
iex> message.body
"{}"
iex> get_meta(message, :content_encoding)
"gzip"
encode(message, opts)

Encodes the message body to gzip and sets the content encoding.

Examples

iex> import Conduit.Message
iex> message =
iex>   %Conduit.Message{}
iex>   |> put_body("{}")
iex>   |> Conduit.Encoding.GZip.encode([])
iex> message.body
<<31, 139, 8, 0, 0, 0, 0, 0, 0, 3, 171, 174, 5, 0, 67, 191, 166, 163, 2, 0, 0, 0>>
iex> get_meta(message, :content_encoding)
"gzip"