You can install TechZDL using pip:
pip install techzdlTo update to the latest version:
pip install --upgrade techzdlIf you encounter issues updating, you can force a reinstall:
pip install --upgrade --force-reinstall techzdlHere is a basic example of how to use TechZDL:
import asyncio
from techzdl import TechZDL
async def main():
# Initialize downloader
downloader = TechZDL(url="https://link.testfile.org/bNYZFw")
# Start download
await downloader.start()
if __name__ == "__main__":
asyncio.run(main())Demo Video: Watch on GitHub
For more examples, check the demos folder in the repository.
You can import the class as follows:
from techzdl import TechZDL| Argument | Type | Default | Description |
|---|---|---|---|
url |
str |
Required | The direct URL of the file to download. |
custom_headers |
dict |
None |
Custom HTTP headers to include in the request. |
output_dir |
str | Path |
"downloads" |
Directory where the file will be saved. |
filename |
str |
None |
Name of the file. If not set, it's determined automatically. |
workers |
int |
None |
Fixed number of download workers. Setting this disables dynamic adjustment. |
initial_dynamic_workers |
int |
2 |
Initial number of workers if dynamic adjustment is active. |
dynamic_workers_update_interval |
int |
5 |
Seconds between checking/updating worker count. |
debug |
bool |
True |
Enable or disable debug logging. |
progress |
bool |
True |
Enable basic progress display (tqdm). |
progress_callback |
Callable |
None |
Custom callback for progress updates. Overrides progress. |
progress_args |
tuple |
() |
Additional arguments to pass to the progress_callback. |
progress_interval |
int |
1 |
Interval (in seconds) for progress updates. |
chunk_size |
int |
5MB |
Size of each download chunk in bytes. |
single_threaded |
bool |
False |
Force standard single-threaded download. |
max_retries |
int |
3 |
Maximum retries for file/chunk downloads. |
| Attribute | Type | Description |
|---|---|---|
id |
str |
Unique identifier for the downloader instance. |
is_running |
bool |
True if the download process is currently active. |
filename |
str |
Final name of the downloaded file. |
output_path |
Path |
Full path to the downloaded file. |
download_success |
bool |
True if the download completed successfully. |
download_error |
Exception |
Contains the exception if an error occurred. |
Starts the download process.
await downloader.start(in_background=False)Arguments:
in_background(bool): IfTrue, runs the download in the background and returnsNoneimmediately. IfFalse, waits for completion.
Returns:
Path: The path to the downloaded file (only ifin_background=False).
Forcefully stops the current download process.
await downloader.stop()Fetches metadata about the file without downloading it.
info = await downloader.get_file_info()Returns: (dict)
filename: The name of the file.total_size: The size of the file in bytes.
- Telegram Support Group: Join Here
- Email: techshreyash123@gmail.com
- Telegram Channel: TechZBots