xuan-luo's picture
download
raw
780 Bytes
#!/usr/bin/env python3
"""Record every package file except the manifest itself."""
import hashlib,json
from pathlib import Path
from datetime import datetime,timezone
root=Path(__file__).resolve().parents[1]
files=[]
for p in sorted(root.rglob('*')):
if not p.is_file() or p==root/'MANIFEST.json': continue
h=hashlib.sha256()
with p.open('rb') as stream:
for block in iter(lambda:stream.read(8*1024*1024),b''): h.update(block)
files.append({'path':str(p.relative_to(root)),'size':p.stat().st_size,'sha256':h.hexdigest()})
data={'created_utc':datetime.now(timezone.utc).isoformat(),'files':files,'total_bytes':sum(x['size'] for x in files)}
(root/'MANIFEST.json').write_text(json.dumps(data,indent=2)+'\n')
print(f"Manifest: {len(files)} files, {data['total_bytes']} bytes")

Xet Storage Details

Size:
780 Bytes
·
Xet hash:
79c8c42878600056c7e25cc33c1b18f532a060872d57f1970466803c1c9ddf82

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.