compressed_string_mod module

Provides functions for compressing and decompressing strings, all in memory.

compressed_string_mod.compress_string(data, bz2_announced=False)[source]

Compress a string.

  1. If we have xz, try to use it.

  2. Fallback: if we have bz2, try to use that.

  3. Else save without compressing.

  4. Or if the compressed version is larger, save without compressing then too.

compressed_string_mod.decompress_string(compressed_data, zero_length_ok=False)[source]

Uncompress a string.