github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/cmn/tests/python/unpack.py (about) 1 import msgpack 2 import os 3 4 5 def unpack_msgpack(path): 6 with open(path, "rb") as f: 7 data = f.read() 8 files_dict = msgpack.unpackb(data, raw=False) 9 for name, content in files_dict.items(): 10 fqn = os.path.join("/tmp/unpacked", name) 11 with open(fqn, "wb") as fh: 12 fh.write(content) 13 print("unpacked " + fqn) 14 15 16 if __name__ == "__main__": 17 unpack_msgpack("/tmp/packed/shard.0")