progress

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MB           = 1024 * 1024
	FloatMB      = float64(MB)
	MaxFileSize  = 2097152000 // 4000 parts of 512 KB each (4000 * 512 * 1024)
	ThreeSeconds = 3 * time.Second
)

Variables

View Source
var (
	ErrFileTooBig = errors.New("file size exceeds 2gb")
)

Functions

This section is empty.

Types

type Proxy

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

func NewProxy

func NewProxy(ctx *ext.Context, update *ext.Update, sent *types.Message, size float64, pxCtx context.Context, pxUid string) (*Proxy, error)

func (*Proxy) DeleteTemp

func (px *Proxy) DeleteTemp()

func (*Proxy) PrepareToUpload

func (px *Proxy) PrepareToUpload() error

PrepareToUpload seeks the underlying fd to the beginning of the file to allow uploading. it also resets the times used for progress and sets the size in case it was unknown while downloading.

func (*Proxy) Read

func (px *Proxy) Read(p []byte) (n int, err error)

Read proxies calls to the underlying file's Read method used in the uploading stage. it will check the time on every call and edit the message with progress as necessary.

func (*Proxy) Write

func (px *Proxy) Write(p []byte) (n int, err error)

Write proxies calls to the underlying file's Write method used in the downloading stage. it will check the time on every call and edit the message with progress as necessary.

Jump to

Keyboard shortcuts

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