示例#1
0
func test1(url string, opts ...interface{}) {
	var st curl.IocopyStat
	err := curl.File(
		url,
		"a.exe",
		append(opts, &st)...)
	fmt.Println(err, "size=", st.Size, "average speed=", st.Speed)
}
示例#2
0
func test3() {
	curl.File(
		"http://tk.wangyuehd.com/soft/skycn/WinRAR.exe_2.exe",
		"a.exe",
		func(st curl.IocopyStat) error {
			fmt.Println(st.Perstr, st.Sizestr, st.Lengthstr, st.Speedstr, st.Durstr)
			return nil
		},
		"maxspeed=", 30*1000,
	)
}
示例#3
0
func test2(url string, opts ...interface{}) {
	curl.File(
		url,
		"a.exe",
		append(opts,
			func(st curl.IocopyStat) error {
				fmt.Println(st.Stat, st.Perstr, st.Sizestr, st.Lengthstr, st.Speedstr, st.Durstr)
				return nil
			}, "timeout=10")...,
	)
}