bundle.core.downloader¶
Attributes¶
Classes¶
Handles asynchronous downloading of files from a specified URL. |
|
Extends Downloader with TQDM progress bar for visual feedback during download. |
Module Contents¶
- bundle.core.downloader.log¶
- class bundle.core.downloader.Downloader(/, **data: Any)[source]¶
Bases:
bundle.core.entity.EntityHandles asynchronous downloading of files from a specified URL.
- destination¶
The local file path to save the downloaded file. If None, data is stored in memory.
- Type:
Path | None
- buffer¶
A buffer to temporarily store the file’s content if no destination is specified.
- Type:
- start(byte_size
int): Placeholder for initialization logic before downloading starts.
- update(byte_count
int): Placeholder for update logic as chunks of data are downloaded.
- destination: pathlib.Path | None = None¶
- start(byte_size: int)[source]¶
Initializes the download process. Placeholder for subclasses to implement.
- update(byte_count: int)[source]¶
Updates the download progress. Placeholder for subclasses to implement.
- async download() bool[source]¶
Asynchronously downloads a file from the specified URL.
The file is either saved to the given destination path or stored in an in-memory buffer. Utilizes aiohttp for asynchronous HTTP requests and aiofiles for async file I/O operations.
- Returns:
True if the download was successful, False otherwise.
- Return type:
- class bundle.core.downloader.DownloaderTQDM(/, **data: Any)[source]¶
Bases:
DownloaderExtends Downloader with TQDM progress bar for visual feedback during download.
Overrides the start, update, and end methods of Downloader to integrate a TQDM progress bar that updates with each downloaded chunk.