fast_download()¶
- Client.fast_download(message: Message | str, file_name: str | BinaryIO | BytesIO | None = None, workers: int = 8, chunk_size: int = 1048576, progress: Callable | None = None, progress_args: tuple = ()) str | BinaryIO | BytesIO | None¶
Download media at maximum speed using multi-part parallel chunk workers.
- Parameters:
message (
Message|str) – A Message object containing media, or a file_id string.file_name (
str|io.BytesIO, optional) – Target file path or BytesIO buffer. Defaults to downloaded file’s original name.workers (
int, optional) – Number of concurrent parallel download workers (1 to 16). Defaults to 8.chunk_size (
int, optional) – Size of each downloaded chunk in bytes. Defaults to 1 MB (1048576).progress (
Callable, optional) – Callback function with signature (current_bytes, total_bytes).
- Returns:
str|io.BytesIO– The path or buffer where media was saved.
Download media at maximum speed using multi-part parallel chunk workers.