Download a file from a given URL to a specified directory.
This function sends a HTTP request to the URL provided, downloads the file and saves it to the specified directory. If the directory does not exist, it creates it. If the file already exists and the overwrite flag is set to False, it skips the download process.
The function also displays a progress bar during the download using the tqdm module, and checks if the download was successful based on the total file size. If the download is not successful, it prints an error message.
Type
Default
Details
url
str
The URL of the file to download.
directory
str
The directory where the file should be saved.
overwrite
bool
False
A flag to specify whether to overwrite the file if it already exists.