import io
import zipfile
import json


def batch_to_zip(bash):
    """Convert the string of a bash script into a zip file"""
    buff = io.BytesIO()
    with zipfile.ZipFile(buff, "w") as zfil:
        zfil.writestr("package/defaults.json", json.dumps({}))
        zfil.writestr("package/script/batch", "#!/usr/bin/env bash\n" + bash)
    return buff