File size: 310 Bytes
b3c7d74
 
58d05d6
b3c7d74
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import zipfile
import io

def save_as_zip(bundle: dict) -> bytes:
    zip_buffer = io.BytesIO()
    with zipfile.ZipFile(zip_buffer, "w") as zipf:
        for filename, content in bundle.get("files", {}).items():
            zipf.writestr(filename, content)
    zip_buffer.seek(0)
    return zip_buffer.read()