Skip to main content

ZipUtil class

This class, ZipUtil, is a utility class that provides static methods for compressing and decompressing data, specifically dictionaries, using zlib compression. This class can be useful for reducing the size of data when transmitting or storing it.

from openfabric_pysdk.utility import ZipUtil

decompress(data: bytes)

This method decompresses the given data and returns a dictionary.

dataThe compressed data in bytes format.bytes
decompressed_data = ZipUtil.decompress(compressed_data)

compress(data: Dict[str, Any])

This method compresses the given data and returns the compressed data as bytes.

dataThe dictionary to be compressed.Dict[str, Any]
data = {'key1': 'value1', 'key2': 'value2'}

compressed_data = ZipUtil.compress(data)
OpenfabricAI Robot
OpenfabricAI FooterOpenfabricAI Footer