Air2: High-Performance Download Engine Air2 is a high-performance, multi-threaded download manager written in Python. It focuses on maximizing download speed through ultra-high concurrency, dynamic chunking strategies, and support for multiple protocols including HTTP/HTTPS, SFTP, and extensible architectures for BitTorrent. The tool provides both an interactive command-line interface (CLI) with modern visual feedback and a scriptable mode for automation. Features High Concurrency: Optimized thread pool supporting up to 200 concurrent workers to maximize bandwidth usage. Dynamic Chunking: Automatically adjusts chunk sizes based on file size to optimize throughput and reduce overhead. Multi-Protocol Support: Native support for HTTP/HTTPS and SFTP; architecture designed for easy addition of BitTorrent and other protocols. Robust Resume Capability: Handles Range requests efficiently to ensure zero data loss during network interruptions. Modern CLI Interface: Built with the rich library for real-time progress bars, speed meters, and ETA calculations without clutter. Intelligent Input: Optional integration with prompt_toolkit for command auto-completion, history navigation, and syntax highlighting. Task Management: Full lifecycle control including add, start, pause, resume, cancel, remove, and automatic ZIP extraction. Speed Limiting: Configurable download speed limits to prevent network congestion. Single File Deployment: Designed as a single executable script for easy distribution and deployment. Installation Ensure you have Python 3.8 or higher installed. Install the required dependencies: bash 1 Note: prompt_toolkit is optional but recommended for enhanced command-line features like auto-completion. Usage Interactive Mode Run the script directly to enter the interactive shell: bash 1 Available Commands: help: Display command list and help text. add [options]: Add a new download task. start : Start a waiting task. pause : Pause a running task. resume : Resume a paused task. cancel : Cancel a task (keeps downloaded files). remove [--delete]: Remove a task and optionally delete the file. unzip [output_dir]: Extract completed ZIP files. list / ls: Show all tasks and their status. status: Display system statistics and overall progress. exit / quit: Close the application. Example: text 1234 Command Line Mode (Scripting) You can also run commands directly from the terminal without entering the interactive shell: bash 1234567891011 Options for add Command --threads=N: Number of concurrent threads (default: 8). --output=DIR: Destination directory (default: current directory). --chunk-size=S: Force specific chunk size (e.g., 10M, 1G). Defaults to dynamic calculation. --speed-limit=N: Limit download speed in KB/s (0 for unlimited). --timeout=N: Request timeout in seconds. --retry=N: Number of retry attempts on failure. Architecture The codebase is structured into distinct modules for maintainability: DownloadEngine: Manages the core logic, including task queues, thread pools, and state synchronization. ChunkDownloader: Handles individual block retrieval, error recovery, and checksum verification. ProtocolHandler: Abstract base class for different protocols (HTTP, SFTP, etc.), allowing easy extension. ModernCLI: Provides the user interface layer using rich and prompt_toolkit. Configuration The engine automatically detects file sizes and adjusts chunk counts. For large files (>1GB), it increases chunk size to 16MB; for medium files (>100MB), it uses 4MB chunks. This dynamic approach minimizes connection overhead while maintaining high parallelism. Users can override these defaults via command-line arguments if specific network conditions require manual tuning. License This project is licensed under the MIT License. Requirements Python 3.8+ requests rich urllib3 prompt_toolkit (optional)