Pulldown is a high-performance, concurrent download manager built with Golang and Angular. It emulates the core logic of tools like IDM (Internet Download Manager) by splitting files into chunks and downloading them in parallel to maximize speed.
-
β‘ Concurrent Downloading: Uses Go Goroutines to split files into 4 chunks and download them simultaneously using HTTP Range headers.
-
π‘ Real-Time Progress: Broadcasts atomic progress updates from the backend to the frontend via WebSockets.
-
π§© Automatic Assembly: Merges file parts (
.tmp) into the final file automatically upon completion. -
π§ Thread-Safe Logic: Uses
sync.Mutexandsync/atomicto safely manage concurrent writes and progress calculations. -
π¨ Modern UI: Angular standalone components with
NgZoneoptimization for smooth, high-performance UI updates. -
π οΈ Robust Error Handling: Handles server edge cases (like servers rejecting concurrent connections) gracefully.
-
Frontend (Angular): Accepts a URL and connects to the backend via HTTP (for commands) and WebSockets (for data).
-
Backend (Go/Gin):
-
Handler: Receives the download request.
-
Calculator: Fetches file headers (
HEAD) and calculates chunk ranges. -
Hydra Engine: Spawns 4 concurrent Goroutines. Each routine manages its own memory buffer and writes directly to the disk.
-
Broadcaster: Throttles and sends JSON progress updates over the active WebSocket connection.
pulldown/
βββ backend/ # Golang API Server
β βββ main.go # API Routes & WebSocket Handler
β βββ downloader.go # Core download logic (Chunking & Merging)
β βββ go.mod # Go dependencies
β βββ (Downloads appear here)
β
βββ frontend/ # Angular Client
βββ src/
β βββ app/components # UI Components
β βββ app/services # WebSocket & HTTP Logic
βββ angular.json
βββ package.json
Prerequisites
Go (v1.20+)
Node.js (v18+) & Angular CLI
- Setup the Backend
Navigate to the backend folder and start the Go server.
cd backend
go mod tidy
go run .The server will start on http://localhost:8080.
- Setup the Frontend
Open a new terminal, navigate to the frontend folder, and start the Angular app.
cd frontend
npm install
ng serve -oThe application will open at http://localhost:4200.
Open the web interface.
Paste a direct download link (e.g., a PDF, Zip, or Image).
Test Link: http://212.183.159.230/5MB.zip
Click Download.
Watch the progress bar update in real-time as the backend fetches and merges the file.
Check the backend/ folder to see your downloaded file.$$
Concurrency: Managing WaitGroups to synchronize multiple download threads.
Memory Management: Replacing io.Copy with manual buffer loops to track bytes as they flow.
Race Conditions: Using sync/atomic to prevent data corruption when multiple threads update the progress counter simultaneously.
Zone Pollution: Debugging Angular's change detection cycle using NgZone.run() to force UI updates from external WebSocket events.
This project is open-source and available under the MIT License.