gorc是类wget多线程下载器,支持直接从资源url并发获取资源
初入社会所作,停止维护,仅供学习使用,不当之处多多包含
多线程并发下载器-gorc
License: MIT License
gorc是类wget多线程下载器,支持直接从资源url并发获取资源
初入社会所作,停止维护,仅供学习使用,不当之处多多包含
url替换为 “http://lax-ca-us-ping.vultr.com/vultr.com.1000MB.bin”
C:\Temp>example -manual=true -thread=10
2019/01/20 18:15:50 manual pattern
2019/01/20 18:15:50 start download
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBa87ff679a2f3e71d9181a67b7542122c start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBeccbc87e4b5ce2fe28308fd9f2a7baf3 start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBc4ca4238a0b923820dcc509a6f75849b start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBc9f0f895fb98ab9159f51fd0297e236d start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MB8f14e45fceea167a5a36dedd4bea2543 start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MB1679091c5a880faf6fb5e6087eb1b2dc start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBc81e728d9d4c2f636f067f89cc14862c start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBd3d9446802a44259755d38e6d163e820 start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MB45c48cce2e2d7fbdea1afc51c7c6ad26 start 104857600
2019/01/20 18:15:50 file C:\Temp\lib\vultr.com.1000MBe4da3b7fbbce2345d7772b0674a318d5 start 104857600
working 100%[====================================================================================================] 109s
2019/01/20 18:17:48 download completed
100Mbps带宽跑满,cpu飚升到25%+
我使用 Internet Download Manager 32个并发下载,同样带宽跑满100Mbps,cpu只有1-5之间浮动,
func sendGet(url string, address string, start int64, end int64) (len int64, err error) {
var req *http.Request
req, err = http.NewRequest("GET", url, nil)
req.Header.Set("Range", "bytes="+strconv.FormatInt(start, 10)+"-"+strconv.FormatInt(end, 10))
req.Header.Set("Connection", "close")
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
var resp *http.Response
resp, err = client.Do(req)
defer resp.Body.Close()
file, err := createFile(address)
len, err = io.Copy(file, resp.Body)
return len, err
}
GOPATH/gorc/file.go line:291
func filePath(id string) string {
t := runtime.GOOS
...
...
if t == MAC {
file = path.Join(root, id)
}
return file
}
应该添加对 Mac 的支持
file.go:55
err := os.MkdirAll(root, 0666) -> err := os.MkdirAll(root, 0755)
know a little en.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.