MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / download

Function download

tools/download_tool.py:106–120  ·  view source on GitHub ↗
(url, response, output)

Source from the content-addressed store, hash-verified

104
105
106def download(url, response, output) -> None:
107 if url.endswith(".zip"):
108 data = io.BytesIO(response.read())
109 with zipfile.ZipFile(data) as f:
110 f.extractall(output)
111 # Make all files executable
112 for root, _, files in os.walk(output):
113 for name in files:
114 os.chmod(os.path.join(root, name), 0o755)
115 output.touch(mode=0o755) # Update dir modtime
116 else:
117 with open(output, "wb") as f:
118 shutil.copyfileobj(response, f)
119 st = os.stat(output)
120 os.chmod(output, st.st_mode | stat.S_IEXEC)
121
122
123def main() -> None:

Callers 1

mainFunction · 0.85

Calls 1

readMethod · 0.80

Tested by

no test coverage detected