Spaces:
Runtime error
Runtime error
| title: Telegram File Streamer | |
| emoji: π | |
| colorFrom: blue | |
| colorTo: purple | |
| sdk: docker | |
| pinned: false | |
| license: mit | |
| # π Telegram Multi-Part File Streamer | |
| A high-performance file upload and streaming service that uses Telegram as a backend storage system. Capable of handling files up to **1TB** with zero-disk buffering. | |
| ## β¨ Features | |
| - **π― Zero-Disk Buffering**: Direct streaming from HTTP to Telegram | |
| - **π¦ Auto-Splitting**: Automatically splits large files into 2GB parts | |
| - **β‘ Multi-Session Load Balancing**: Maximum bandwidth with session rotation | |
| - **π‘ Range Request Support**: HTTP 206 for seeking in large files | |
| - **π Parallel Downloads**: IDM and multi-threaded downloader compatible | |
| - **πΎ Low Memory**: Optimized for <512MB RAM usage | |
| ## π§ Required Secrets | |
| This Space requires the following environment variables (add in Settings β Repository secrets): | |
| | Variable | Description | Example | | |
| |----------|-------------|---------| | |
| | `API_ID` | Telegram API ID | `12345678` | | |
| | `API_HASH` | Telegram API Hash | `abc123def456...` | | |
| | `BOT_TOKEN` | Bot Token from @BotFather | `1234567890:ABC...` | | |
| | `MONGO_URI` | MongoDB connection string | `mongodb+srv://...` | | |
| | `SESSION_STRINGS` | Session strings (optional) | `BQAB...,BQAC...` | | |
| ### How to Get Credentials: | |
| **Telegram API (API_ID & API_HASH):** | |
| 1. Visit https://my.telegram.org/apps | |
| 2. Login and create application | |
| 3. Copy api_id and api_hash | |
| **Bot Token:** | |
| 1. Search @BotFather on Telegram | |
| 2. Send `/newbot` command | |
| 3. Copy bot token | |
| **MongoDB:** | |
| - Free: MongoDB Atlas (https://www.mongodb.com/cloud/atlas) | |
| - Create cluster β Get connection string | |
| ## π‘ API Endpoints | |
| ### Upload File | |
| ```bash | |
| POST /upload?filename=myfile.zip | |
| curl -X POST "https://YOUR-SPACE.hf.space/upload?filename=file.zip" \ | |
| -H "Content-Type: application/octet-stream" \ | |
| --data-binary "@file.zip" | |
| ``` | |
| ### Download File | |
| ```bash | |
| GET /dl/{unique_id} | |
| curl "https://YOUR-SPACE.hf.space/dl/{unique_id}" -o output.zip | |
| ``` | |
| ### Get File Info | |
| ```bash | |
| GET /info/{unique_id} | |
| ``` | |
| ### Health Check | |
| ```bash | |
| GET /health | |
| curl "https://YOUR-SPACE.hf.space/health" | |
| ``` | |
| ## π Performance | |
| | Metric | Value | | |
| |--------|-------| | |
| | Max File Size | 1TB+ | | |
| | Upload Speed | 10-15 MB/s per session | | |
| | Download Speed | 50-100 MB/s | | |
| | RAM Usage | <512MB constant | | |
| ## β οΈ Important | |
| - Ensure Telegram TOS compliance | |
| - Files stored in your Telegram account | |
| - Add multiple SESSION_STRINGS for better performance | |
| - MongoDB IP whitelist: 0.0.0.0/0 | |
| ## π Troubleshooting | |
| **Build Failed:** | |
| - Check all secrets are set correctly | |
| - Verify MongoDB URI is valid | |
| **FloodWait Errors:** | |
| - Add more SESSION_STRINGS | |
| - Use user sessions instead of bot only | |
| **Out of Memory:** | |
| - Upgrade Space hardware in Settings | |
| ## π License | |
| MIT License | |
| --- | |
| **Made with β€οΈ for the community** | |
| *Disclaimer: Use responsibly and comply with Telegram's Terms of Service.* |