Kombu.Compression (Kombu v0.1.0)

Copy Markdown View Source

Message compression and decompression registry matching kombu.compression.

Note: Python Kombu maps "gzip" and "zlib" ("application/x-gzip") to zlib.compress / zlib.decompress (zlib framing via Erlang's :zlib module).

Summary

Functions

Compress body using content_type (or alias such as "gzip" / "zlib"), returning {compressed_binary, canonical_content_type}.

Decompress body using content_type (or alias).

Return a list of registered compression MIME content-types.

Look up decoder_fn for a content-type or alias.

Look up {encoder_fn, canonical_content_type} for a content-type or alias.

Register a compression encoder and decoder for content_type with optional aliases.

Reset and register default built-in compression codecs (application/x-gzip).

Functions

compress(body, content_type)

@spec compress(binary() | Kombu.Utils.JSON.Bytes.t(), String.t()) ::
  {binary(), String.t()}

Compress body using content_type (or alias such as "gzip" / "zlib"), returning {compressed_binary, canonical_content_type}.

decompress(body, content_type)

@spec decompress(binary(), String.t()) :: binary()

Decompress body using content_type (or alias).

encoders()

@spec encoders() :: [String.t()]

Return a list of registered compression MIME content-types.

get_decoder(t)

@spec get_decoder(String.t()) :: (binary() -> binary())

Look up decoder_fn for a content-type or alias.

get_encoder(t)

@spec get_encoder(String.t()) :: {(binary() -> binary()), String.t()}

Look up {encoder_fn, canonical_content_type} for a content-type or alias.

register(encoder, decoder, content_type, aliases \\ [])

@spec register((binary() -> binary()), (binary() -> binary()), String.t(), [
  String.t()
]) :: :ok

Register a compression encoder and decoder for content_type with optional aliases.

register_defaults()

Reset and register default built-in compression codecs (application/x-gzip).