Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A lightweight, command-line wget clone built with Go. Efficient and fast, this tool mirrors the core functionality of wget, with minimal dependencies and optimized performance for file downloads.

Notifications You must be signed in to change notification settings

nguonodave/wgetgo

Repository files navigation


Wget in Go

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.

Objectives

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-limit flag.
  • 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.

Usage

The program takes a URL as an argument and outputs detailed information about the download process. Example usage:

$ go run . https://example.com/file.zip

This 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:07

Incase 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.

About

A lightweight, command-line wget clone built with Go. Efficient and fast, this tool mirrors the core functionality of wget, with minimal dependencies and optimized performance for file downloads.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published