|
@@ -22,7 +22,15 @@ def compress_file_tar(file_path, output_filename):
|
|
|
|
|
|
with tarfile.open(output_filename, "w:gz", format=tarfile.GNU_FORMAT) as tar:
|
|
|
|
|
|
- tar.add(file_path, arcname=os.path.basename(file_path))
|
|
|
+
|
|
|
+ file_name = os.path.basename(file_path)
|
|
|
+
|
|
|
+ with open(file_path, 'rb') as file_to_add:
|
|
|
+
|
|
|
+ tar_info = tarfile.TarInfo(name=file_name)
|
|
|
+
|
|
|
+ tar_info.size = os.path.getsize(file_path)
|
|
|
+ tar.addfile(tar_info, fileobj=file_to_add)
|
|
|
|
|
|
def compress_tar(folder_path, output_filename):
|
|
|
|