Files
antonioCoco-SharPyShell/utils/gzip_utils.py
T
NuHarborMartin 39e931ff27 Initial Python3 conversion
Fixing the string/bytes conversion needed to work with python3
All modules tested (except lateral)  and responding as they did with 2.7 on an IIS10 box
2021-08-04 11:57:46 -04:00

15 lines
415 B
Python

import io
import gzip
import base64
def get_compressed_base64_from_file(path):
with open(path, 'rb') as f:
read_data = f.read()
return base64.b64encode(gzip.compress(read_data)).decode()
def get_compressed_base64_from_binary(bin_bytearray_input):
print(base64.b64encode(gzip.compress(bin_bytearray_input)).decode())
return base64.b64encode(gzip.compress(bin_bytearray_input)).decode()