Documentation ¶
Overview ¶
Package uploader contains uploading files helpers.
Index ¶
- Constants
- type File
- type Progress
- type ProgressState
- type Reader
- type Upload
- type Uploader
- func (u *Uploader) Upload(ctx context.Context, upload *Upload) (tg.InputFileClass, error)
- func (u *Uploader) WithIDGenerator(cb func() (int64, error)) *Uploader
- func (u *Uploader) WithPartSize(partSize int) *Uploader
- func (u *Uploader) WithProgress(progress Progress) *Uploader
- func (u *Uploader) WithThreads(limit int) *Uploader
Constants ¶
View Source
const (
// `524288 % part_size = 0` (512KB must be evenly divisible by part_size)
MaximumPartSize = 524288
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Progress ¶
type Progress interface {
Chunk(ctx context.Context, state ProgressState) error
}
Progress is interface of upload process tracker.
type ProgressState ¶
ProgressState represents upload state change.
type Upload ¶
type Upload struct {
// contains filtered or unexported fields
}
Upload represents Telegram file upload.
func FromReader ¶
FromReader creates new Upload struct using given io.Reader. Note: Upload created with this builder will not be seekable, so upload can't be repeatable.
type Uploader ¶
type Uploader struct {
// contains filtered or unexported fields
}
Uploader is Telegram file uploader.
func (*Uploader) WithIDGenerator ¶
WithIDGenerator sets id generator.
func (*Uploader) WithPartSize ¶
WithPartSize sets part size. Should be divisible by 1024. 524288 should be divisible by partSize.
func (*Uploader) WithProgress ¶
WithProgress sets progress callback.
func (*Uploader) WithThreads ¶
WithThreads sets uploading goroutines limit per upload.
Click to show internal directories.
Click to hide internal directories.