1
1
<div align =" center " >
2
2
<h1>Got.</h1>
3
- <h4 align="center">
4
- Simple and fast concurrent downloader.
3
+ <h4 align="center">
4
+ Simple and fast concurrent downloader.
5
5
</h4>
6
6
</div >
7
7
8
8
<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>
13
13
</p >
14
14
15
15
## Comparison
16
16
17
- Comparison in my machine :
17
+ Comparison in cloud server :
18
18
19
19
``` 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
-
27
20
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!
37
23
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
42
27
43
- real 0m10.273s
44
- user 0m0.205s
45
- sys 0m3.296s
46
28
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
49
30
% 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
52
37
53
- real 0m33.318s
54
- user 0m0.420s
55
- sys 0m2.056s
56
38
```
57
39
40
+
58
41
## Installation
59
42
60
43
#### Download and install the latest [ release] ( https://github.com/melbahja/got/releases ) :
@@ -85,14 +68,29 @@ go get github.com/melbahja/got/cmd/got
85
68
got https://example.com/file.mp4
86
69
```
87
70
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:
89
82
``` bash
90
- got --out /path/to/save https://example.com/file.mp4
83
+ got --dir /path/to/dir -f urls.txt
91
84
```
92
85
93
- #### To see all available flags type :
86
+ ### You can pipe multiple URLs :
94
87
``` 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
96
94
```
97
95
98
96
@@ -107,20 +105,23 @@ import "github.com/melbahja/got"
107
105
108
106
func main () {
109
107
110
- dl, err := got.New(" https://example.com/file.mp4 " , " /path/to/save " )
108
+ g := got.New ()
111
109
112
- if err ! = nil {
113
- // handle the error!
114
- }
110
+ err := g.Download(" http://localhost/file.ext" , " /path/to/save" )
115
111
116
- // Start the download
117
- err = dl.Start ()
112
+ if err ! = nil {
113
+ // ..
114
+ }
118
115
}
119
116
120
117
` ` `
121
118
122
119
For more see [GoDocs](https://pkg.go.dev/github.com/melbahja/got).
123
120
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
+
124
125
125
126
# # License
126
127
0 commit comments