gorc

package module
v0.0.0-...-2edec14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 17 Imported by: 0

README

多线程并发下载器-gorc

gorc是类wget多线程下载器,支持直接从资源url并发获取资源

初入社会所作,停止维护,仅供学习使用,不当之处多多包含

使用说明:
1.手动选择模式和自动分配模式,参数:manual,默认为false/自动
2.指定并发线程数,参数:thread,默认为5
3.指定下载的url,参数:url
4.指定分块下载的块大小,参数:blockSize,例如,默认1代表16m,2代表32m,4代表64m,以此类推
5.指定分块下载失败后尝试次数,参数:attempt,默认为3
6.指定文件存放位置,参数:root,默认为项目的lib目录
7.程序使用秩序调用gorc.Download(url string)函数即可
功能点:
1.支持多线程并发下载
2.支持断点续传
3.支持进度条显示
4.支持手动设置临时文件大小
5.支持自动清理缓存文件
效果示例:

Windows7下
自动模式

自动续传模式

手动模式

手动续传模式

Documentation

Index

Constants

View Source
const (
	LEVEL   int64 = 1024
	RULE    int64 = LEVEL * LEVEL * 16
	WINDOWS       = "windows"
	LINUX         = "linux"
)

Variables

View Source
var Count int

var Context *context = new(context)

Functions

func Download

func Download(url string, thread int64, manual bool, root string, blockSize int64, attempt int, filename string) (err error)

func GetEndName

func GetEndName() string

func MD5

func MD5(text string) string

生成32位MD5

Types

type File

type File struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL