paralleldownload

package module
v0.0.0-...-cee228d Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 12 Imported by: 0

README

ParallelDownload

Golang HTTP Downloader using Ranges for parallel downloads.

QuickStart

go get -u github.com/Doraemonkeys/ParallelDownload
package main

import (
	"fmt"

	pd "github.com/Doraemonkeys/ParallelDownload"
)

func main() {
	var worker int64 = 5
	err :=  pd.ParallelDownload("https://XXX/XXX.XX", "", "", worker)
	if err != nil {
		fmt.Println("download failed:", err)
		return
	}
	fmt.Println("download success")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(url string, savePath string, filename string) error

filename为文件名,savePath为文件存储的路径,两者都可省略。

func ParallelDownload

func ParallelDownload(download_url string, savePath string, filename string, worker_count int64) (err error)

url为下载直链,若不支持多线程下载将尝试普通下载。 filename为文件名,savePath为文件存储的路径,两者都可省略。

Types

This section is empty.

Jump to

Keyboard shortcuts

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