Download files from Osmium servers using the chunked download system.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/osmiumchat/proto/llms.txt
Use this file to discover all available pages before exploring further.
Download Process
Download File Part
Usemedia.downloadFilePart to download file data in chunks:
Reference to the file to download
Byte offset to start reading from (0-indexed)
Number of bytes to read
Response
The server responds with aFilePart message:
Binary data for the requested file part
FileRef Variants
TheFileRef type supports different file reference contexts:
MediaFileRef
Reference to a file attached to a message:Snowflake ID of the file
ChatPhotoFileRef
Reference to a chat photo or avatar:Snowflake ID of the chat photo
Download Examples
Full File Download
Partial Download (Streaming)
Download Chat Photo
Best Practices
Chunk Size
- Images/Small files: 256 KB - 512 KB chunks
- Videos/Large files: 512 KB - 1 MB chunks
- Streaming: Smaller chunks (128 KB - 256 KB) for faster initial display
Performance
- Parallel downloads: Download multiple chunks concurrently (with rate limiting)
- Resume support: Track downloaded offsets to resume interrupted downloads
- Caching: Cache downloaded files locally to avoid re-downloading
Error Handling
- Retry logic: Retry failed chunk downloads with exponential backoff
- Validation: Verify file size matches expected size from metadata
- Partial data: Handle incomplete chunks gracefully
Download Flow
- Get file metadata: Retrieve
Fileobject with size and metadata - Calculate chunks: Determine how many chunks needed based on file size
- Download parts: Request each part sequentially or in parallel
- Reassemble: Concatenate all parts in order
- Validate: Verify complete file matches expected size