Spaces:
Sleeping
Sleeping
File size: 519 Bytes
66dd7b3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import requests
def download_file(url: str, local_filepath: str) -> None:
"""
Download a file from a URL and save it locally.
Args:
url (str): The URL of the file to download.
local_filename (str): The local path where the file will be saved.
"""
with requests.get(url, stream=True) as response:
response.raise_for_status()
with open(local_filepath, 'wb') as file:
for chunk in response.iter_content(chunk_size=8192):
file.write(chunk)
|