miniproto.media.download
miniproto.media.download
Section titled “miniproto.media.download”Concurrent Telegram media downloading with retry, integrity, cache, and destination handling.
The public coroutines support bounded streaming and file materialization while preserving ordered ranges, cancellable cleanup, optional CDN/plain-file verification, and safe reuse of cached byte ranges.
Public objects
Section titled “Public objects”Destination— Public type aliasminiproto.media.download.Destination.MediaDownloadError— Raised when a requested media range cannot be downloaded or materialized.MediaIntegrityError— Raised when declared file hashes or download-range invariants are violated.MAX_DOWNLOAD_CHUNK_SIZE— Public attributeminiproto.media.download.MAX_DOWNLOAD_CHUNK_SIZE.DEFAULT_DOWNLOAD_PART_SIZE— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_PART_SIZE.DEFAULT_DOWNLOAD_CONCURRENCY— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_CONCURRENCY.DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES.DEFAULT_RANGE_CACHE_BYTES— Public attributeminiproto.media.download.DEFAULT_RANGE_CACHE_BYTES.MediaDownloadResult— Completed materialized-download metadata and optional in-memory payload.DownloadRangeCache— Async LRU cache that deduplicates exact media-range requests and bounded prefetches.iter_download— Stream an exact media range as ordered, bounded byte chunks.download_file— Download media into memory, a path, or a caller-owned binary stream.iter_download_media— Resolve a supported media object and stream it through :func:iter_download.download_media— Resolve media and materialize it through :func:download_file.download_location_from_media— Resolve a media model, raw Telegram object, file ID, or input location for download.media_from_raw— Normalize supported raw Telegram media shapes into a :class:Mediarecord.