Back to godoc.org
github.com/pgollangi/fastget

Package fastget

v0.2.0
Latest Go to latest

The latest major version is .

Published: Sep 9, 2020 | License: MIT | Module: github.com/pgollangi/fastget

Index

type FastGetter

type FastGetter struct {
	FileURL    string
	Workers    int
	OutputFile string
	// Headers to be included to while making requests
	Headers map[string]string
	// OnBeforeStart to be called before even download start
	OnBeforeStart func(int64, int64)

	// OnStart to be called on started downloading a chunk / a part
	OnStart func(int, int64)
	// OnProgress to be called on change in progress of downloading a chunk / a part
	OnProgress func(int, int64)
	// OnFinish to be called on finished downloading a chunk / a part
	OnFinish func(int)
}

FastGetter Represents the information required to fastget a file url

func NewFastGetter

func NewFastGetter(fileURL string) (*FastGetter, error)

NewFastGetter creates and returns an instance of FastGetter

func (*FastGetter) Get

func (fg *FastGetter) Get() (*Result, error)

Get ultrafast downloads the file

type Result

type Result struct {
	FileURL     string
	Size        int64
	OutputFile  *os.File
	ElapsedTime time.Duration
}

Result represents the result of fastget

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier