python gz解压
def decompose_file(data):
# ungz_file_path = gz_file_path.replace(".gz", "")
# with gzip.open(gz_file_path, 'rb') as f_in:
# with open(ungz_file_path, 'wb') as f_out:
# shutil.copyfileobj(f_in, f_out)
new_data = gzip.decompress(data)
return new_data
其中data是源文件的buffer,new_data是解压之后的新文件的buffer,直接操作就行了。