This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.3.

# Message Compression - `kombu.compression`

Compression utilities.

## Encoding/decoding

kombu.compression.compress(body, content_type)

  Compress text.

  ### Arguments:

  > body (AnyStr): The text to compress. content_type (str): mime-type of compression method to use.

kombu.compression.decompress(body, content_type)

  Decompress compressed text.

  ### Arguments:

  > body (AnyStr): Previously compressed text to uncompress. content_type (str): mime-type of compression method used.

## Registry

kombu.compression.encoders()

  Return a list of available compression methods.

kombu.compression.get_encoder(t)

  Get encoder by alias name.

kombu.compression.get_decoder(t)

  Get decoder by alias name.

kombu.compression.register(encoder, decoder, content_type, aliases=None)

  Register new compression method.

  ### Arguments:

  > encoder (Callable): Function used to compress text. decoder (Callable): Function used to decompress previously

  > > compressed text.

  > content_type (str): The mime type this compression method

  >   identifies as.

  > aliases (Sequence[str]): A list of names to associate with

  >   this compression method.