Skip to content

miniproto.media.download.iter_download_media

miniproto.media.download.iter_download_media

Section titled “miniproto.media.download.iter_download_media”
iter_download_media(invoke: RawInvoker, media: object, **kwargs: Any) -> AsyncGenerator[bytes]

Resolve a supported media object and stream it through :func:iter_download.

Parameters:

  • invoke (RawInvoker) – Async raw-RPC invoker used for file requests.
  • media (object) – A :class:Media, file ID, raw document/photo/message, or input file location.
  • kwargs (Any) – Forwarded **kwargs download options; a missing cache key and total size are inferred when possible.

Yields:

  • AsyncGenerator[bytes] – Ordered byte chunks with the cancellation, caching, CDN, and integrity semantics of :func:iter_download.

Raises:

  • MediaDownloadErrormedia cannot be resolved to an input file location.
  • CancelledError – The active stream is cancelled and its pending requests are cleaned up.