This project recreates the functionalities of the wget command-line utility using Go. It enables file downloads from the web with features for background downloading, speed control, saving to specific directories, asynchronous downloading of multiple files, and mirroring entire websites.
This implementation includes the following features:
- Download Single File: Download a file from a given URL.
- Save As Different Name: Specify a custom name for the downloaded file.
- Save to Specific Directory: Choose a directory to save the file.
- Download Speed Limiting: Limit the download speed with a
--rate-limitflag. - Background Downloading: Run downloads in the background with output redirected to a log file.
- Asynchronous Multiple Downloads: Download multiple files concurrently by reading URLs from a file.
- Website Mirroring: Download and save a website's content for offline viewing.
The program takes a URL as an argument and outputs detailed information about the download process. Example usage:
$ go run . https://example.com/file.zipThis command will display:
- Start Time: Timestamp of when the download began.
- Request Status: HTTP status of the response (e.g., 200 OK).
- File Size: Size in bytes and rounded in MB/GB.
- File Path: Name and location of the saved file.
- Progress Bar: Shows downloaded size, percentage, and remaining time.
- End Time: Timestamp when the download completes.
Example output:
start at 2024-10-29 13:46:06
sending request, awaiting response... status 200 OK
content size: 1048576 [~1.05MB]
saving file to: ./file.zip
512.00 KiB / 1.05 MB [=======> ] 50.00% 512 KiB/s 1s remaining
Downloaded [https://example.com/file.zip]
finished at 2024-10-29 13:46:07Incase this is not clear your can try inputting the following command which will also help go run . -h. This will give a clear guide of the flags and how to use our wget implementation.