Skip to content

download_file_from_github

Source code in tinybig/util/utility.py
def download_file_from_github(url_link: str, destination_path: str):
    create_directory_if_not_exists(destination_path)

    response = requests.get(url_link, stream=True)
    if response.status_code == 200:
        with open(destination_path, 'wb') as file:
            for chunk in response.iter_content(1024):  # Download in chunks
                file.write(chunk)
        print(f"File downloaded successfully: {destination_path}")
    else:
        print(f"Failed to download file. Status code: {response.status_code}")