downloader

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 6 Imported by: 26

Documentation

Overview

Package downloader contains downloading files helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Download

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

Download represents Telegram file download.

func NewDownload

func NewDownload(file tg.InputFileLocationClass, cdn bool, output io.Writer) Download

NewDownload creates new Download struct.

type Downloader

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

Downloader is Telegram file downloader.

func NewDownloader

func NewDownloader() *Downloader

NewDownloader creates new Downloader.

func (*Downloader) Download

func (d *Downloader) Download(ctx context.Context, rpc *tg.Client, download Download) (tg.StorageFileTypeClass, error)

Download download data from Telegram server to given output.

func (*Downloader) WithPartSize

func (d *Downloader) WithPartSize(partSize int) *Downloader

WithPartSize sets part size. Must be divisible by 4KB.

See https://core.telegram.org/api/files#downloading-files.

type RedirectError

type RedirectError struct {
	*tg.UploadFileCdnRedirect
}

RedirectError error is returned when Downloader get CDN redirect. See https://core.telegram.org/constructor/upload.fileCdnRedirect.

func (*RedirectError) Error

func (r *RedirectError) Error() string

Error implements error interface.

Jump to

Keyboard shortcuts

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