https://github.com/melbahja/got
Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!
https://github.com/melbahja/got
chunks cli download-file download-photos download-songs download-videos downloader fast-downward go golang hacktoberfest partial-content
Last synced: 6 months ago
JSON representation
Got: Simple golang package and CLI tool to download large files faster 🏃 than cURL and Wget!
- Host: GitHub
- URL: https://github.com/melbahja/got
- Owner: melbahja
- License: mit
- Created: 2020-06-06T23:46:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-16T16:07:28.000Z (almost 2 years ago)
- Last Synced: 2024-05-22T11:31:47.667Z (over 1 year ago)
- Topics: chunks, cli, download-file, download-photos, download-songs, download-videos, downloader, fast-downward, go, golang, hacktoberfest, partial-content
- Language: Go
- Homepage:
- Size: 180 KB
- Stars: 704
- Watchers: 14
- Forks: 44
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- command-line-tools - Got - Simple and fast concurrent downloader. (Other)
README
Got.
Simple and fast concurrent downloader.
Installation ❘
CLI Usage ❘
Module Usage ❘
License

## Comparison
Comparison in cloud server:
```bash
[root@centos-nyc-12 ~]# time got -o /tmp/test -c 20 https://proof.ovh.net/files/1Gb.dat
URL: https://proof.ovh.net/files/1Gb.dat done!
real 0m8.832s
user 0m0.203s
sys 0m3.176s
[root@centos-nyc-12 ~]# time curl https://proof.ovh.net/files/1Gb.dat --output /tmp/test1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1024M 100 1024M 0 0 35.6M 0 0:00:28 0:00:28 --:--:-- 34.4M
real 0m28.781s
user 0m0.379s
sys 0m1.970s
```
## Installation
#### Download and install the latest [release](https://github.com/melbahja/got/releases):
```bash
# go to tmp dir.
cd /tmp
# Download latest version.
curl -sfL https://git.io/getgot | sh
# Make the binary executable.
chmod +x /tmp/bin/got
# Move the binary to your PATH
sudo mv /tmp/bin/got /usr/bin/got
```
#### Or Go ahead compile it yourself:
```bash
go install github.com/melbahja/got/cmd/got@latest
```
#### Or from the AUR
Install [`got`](https://aur.archlinux.org/packages/got/) for the latest release version or `got-git` for the latest development version.
> **Note:** these packages are not maintained by melbahja
## Command Line Tool Usage
#### Simple usage:
```bash
got https://example.com/file.mp4
```
#### You can specify destination path:
```bash
got -o /path/to/save https://example.com/file.mp4
```
#### You can download multiple URLs and save them to directory:
```bash
got --dir /path/to/dir https://example.com/file.mp4 https://example.com/file2.mp4
```
#### You can download multiple URLs from a file:
```bash
got --dir /path/to/dir -f urls.txt
```
### You can pipe multiple URLs:
```bash
cat urls.txt | got --dir /path/to/dir
```
#### Docs for available flags:
```bash
got help
```
## Module Usage
You can use Got to download large files in your go code, the usage is simple as the CLI tool:
```bash
package main
import "github.com/melbahja/got"
func main() {
g := got.New()
err := g.Download("http://localhost/file.ext", "/path/to/save")
if err != nil {
// ..
}
}
```
For more see [PkgDocs](https://pkg.go.dev/github.com/melbahja/got).
## How It Works?
Got takes advantage of the HTTP range requests support in servers [RFC 7233](https://tools.ietf.org/html/rfc7233), if the server supports partial content Got split the file into chunks, then starts downloading and merging the chunks into the destinaton file concurrently.
## License
Got is provided under the [MIT License](https://github.com/melbahja/got/blob/master/LICENSE) © Mohammed El Bahja.