files#

This module contains basic methods for gzip compression and decompression.

compress_file#

pocketwelt.files.compress_file(file_path: str, compressed_file_path: str) None#

Compress file using GZIP.

Parameters:
  • file_path (str) – The path to the file to be compressed.

  • compressed_file_path (str) – The path where the compressed file will be saved.

decompress_file#

pocketwelt.files.decompress_file(compressed_file_path: str) Any#

Decompress a GZIP-compressed file and return its contents.

Parameters:

compressed_file_path (str) – The path to the compressed file.

Returns:

The decompressed and deserialized content of the file.

We first read the content and then try unpickling. If that fails we simply decode the content from bytes.

Return type:

Any