11<div align =" center " >
22 <h1>Got.</h1>
3- <h4 align="center">
4- Simple and fast concurrent downloader.
3+ <h4 align="center">
4+ Simple and fast concurrent downloader.
55 </h4>
66</div >
77
88<p align =" center " >
9- <a href="#installation">Installation</a> ❘
10- <a href="#command-line-tool-usage">CLI Usage</a> ❘
11- <a href="#module-usage">Module Usage</a> ❘
12- <a href="#license">License</a>
9+ <a href="#installation">Installation</a> ❘
10+ <a href="#command-line-tool-usage">CLI Usage</a> ❘
11+ <a href="#module-usage">Module Usage</a> ❘
12+ <a href="#license">License</a>
1313</p >
1414
1515## Comparison
1616
17- Comparison in my machine :
17+ Comparison in cloud server :
1818
1919``` bash
20- // cURL
21- $ time curl http://speedtest.ftp.otenet.gr/files/test10Mb.db --output test
22-
23- real 0m38.225s
24- user 0m0.044s
25- sys 0m0.199s
26-
2720
28- // Got
29- $ time got --out test http://speedtest.ftp.otenet.gr/files/test10Mb.db
30-
31- real 0m7.136s
32- user 0m0.793s
33- sys 0m0.507s
34- ```
35- ---
36- Comparison in cloud server:
21+ [root@centos-nyc-12 ~ ]# time got -o /tmp/test -c 20 http://www.ovh.net/files/1Gio.dat
22+ URL: http://www.ovh.net/files/1Gio.dat done!
3723
38- ``` bash
39- // Got
40- $ time got --out /tmp/test http://www.ovh.net/files/1Gio.dat
41- Total Size: 1.1 GB | Chunk Size: 54 MB | Concurrency: 10 | Progress: 1.1 GB | Done!
24+ real 0m8.832s
25+ user 0m0.203s
26+ sys 0m3.176s
4227
43- real 0m10.273s
44- user 0m0.205s
45- sys 0m3.296s
4628
47- // cURL
48- $ time curl http://www.ovh.net/files/1Gio.dat --output /tmp/test1
29+ [root@centos-nyc-12 ~ ]# time curl http://www.ovh.net/files/1Gio.dat --output /tmp/test1
4930 % Total % Received % Xferd Average Speed Time Time Time Current
50- Dload Upload Total Spent Left Speed
51- 100 1024M 100 1024M 0 0 30.8M 0 0:00:33 0:00:33 --:--:-- 36.4M
31+ Dload Upload Total Spent Left Speed
32+ 100 1024M 100 1024M 0 0 35.6M 0 0:00:28 0:00:28 --:--:-- 34.4M
33+
34+ real 0m28.781s
35+ user 0m0.379s
36+ sys 0m1.970s
5237
53- real 0m33.318s
54- user 0m0.420s
55- sys 0m2.056s
5638```
5739
40+
5841## Installation
5942
6043#### Download and install the latest [ release] ( https://github.com/melbahja/got/releases ) :
@@ -85,14 +68,29 @@ go get github.com/melbahja/got/cmd/got
8568got https://example.com/file.mp4
8669```
8770
88- #### Or you can specify destination path:
71+ #### You can specify destination path:
72+ ``` bash
73+ got -o /path/to/save https://example.com/file.mp4
74+ ```
75+
76+ #### You can download multiple URLs and save them to directory:
77+ ``` bash
78+ got --dir /path/to/dir https://example.com/file.mp4 https://example.com/file2.mp4
79+ ```
80+
81+ #### You can download multiple URLs from a file:
8982``` bash
90- got --out /path/to/save https://example.com/file.mp4
83+ got --dir /path/to/dir -f urls.txt
9184```
9285
93- #### To see all available flags type :
86+ ### You can pipe multiple URLs :
9487``` bash
95- got --help
88+ cat urls.txt | got --dir /path/to/dir
89+ ```
90+
91+ #### Docs for available flags:
92+ ``` bash
93+ got help
9694```
9795
9896
@@ -107,20 +105,23 @@ import "github.com/melbahja/got"
107105
108106func main () {
109107
110- dl, err := got.New(" https://example.com/file.mp4 " , " /path/to/save " )
108+ g := got.New ()
111109
112- if err ! = nil {
113- // handle the error!
114- }
110+ err := g.Download(" http://localhost/file.ext" , " /path/to/save" )
115111
116- // Start the download
117- err = dl.Start ()
112+ if err ! = nil {
113+ // ..
114+ }
118115}
119116
120117` ` `
121118
122119For more see [GoDocs](https://pkg.go.dev/github.com/melbahja/got).
123120
121+ # # How It Works?
122+
123+ Got takes advantage of the HTTP range requests support in servers [RFC 7233](https://tools.ietf.org/html/rfc7233), if the requested URL server supports partial content Got split the file into chunks, then starts downloading and merging them into the destinaton file concurrently.
124+
124125
125126# # License
126127
0 commit comments