Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xxaier committed Jun 2, 2023
1 parent ee45615 commit f47adc6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions onnx/export/tar.bz2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@


def txz(folder_path, output_path):
# 创建.tar文件流
tar_stream = bz2.BZ2File(output_path, 'w')
stream = bz2.BZ2File(output_path, 'w')

# 将文件夹压缩为.tar文件流
with tarfile.TarFile(fileobj=tar_stream, mode='w') as tar:
tar.add(folder_path, arcname='')
with tarfile.TarFile(fileobj=stream, mode='w') as tar:
tar.add(folder_path, arcname='')

# 关闭.tar文件流
tar_stream.close()
stream.close()


txz(ONNX_DIR, ONNX_DIR + '.tar.bz2')

0 comments on commit f47adc6

Please sign in to comment.