download

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, dst string, reader FileReader, listener gprogress.Listener) (err error)

func Tune

func Tune(size int)

Types

type FileReader

type FileReader interface {
	GetFileSize() (int64, error)
	GetObjectByRange(offset, size int64) (io.ReadCloser, error)
}

type HttpReader

type HttpReader struct {
	Url string
}

func (HttpReader) GetFileSize

func (h HttpReader) GetFileSize() (int64, error)

func (HttpReader) GetObjectByRange

func (h HttpReader) GetObjectByRange(offset, size int64) (io.ReadCloser, error)

type Instance

type Instance struct {
	Workers  int    `yaml:"workers" default:"4"`
	PartSize string `yaml:"part-size" default:"100MiB"`

	BufSize string `yaml:"buf-size" default:"2MiB"`
	// contains filtered or unexported fields
}

func Get

func Get() *Instance

func (*Instance) Download

func (d *Instance) Download(ctx context.Context, dst string, reader FileReader, listener gprogress.Listener) (err error)

func (*Instance) GetName

func (d *Instance) GetName() string

func (*Instance) Run

func (d *Instance) Run() error

func (*Instance) Tune

func (d *Instance) Tune(size int)

type OssReader

type OssReader struct {
	ObjectName string
	Client     *helper_oss.Client
}

func (OssReader) GetFileSize

func (o OssReader) GetFileSize() (int64, error)

func (OssReader) GetObjectByRange

func (o OssReader) GetObjectByRange(offset, size int64) (io.ReadCloser, error)

type S3Reader

type S3Reader struct {
	ObjectName string
	Client     *helper_s3.Client
}

func (S3Reader) GetFileSize

func (o S3Reader) GetFileSize() (int64, error)

func (S3Reader) GetObjectByRange

func (o S3Reader) GetObjectByRange(offset, size int64) (io.ReadCloser, error)

Jump to

Keyboard shortcuts

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