Skip to content

feat: download to writer for medias. - #704

Open
arshamalh wants to merge 1 commit into
tucnak:v3from
arshamalh:v3
Open

arshamalh wants to merge 1 commit into
tucnak:v3from
arshamalh:v3

Conversation

@arshamalh

Copy link
Copy Markdown

In case of (b *Bot) Download(file *File, localFilename string) error function, users may need different actions than just saving the file automatically on disk, e.g.

  • storing the file on minio, s3, etc.
  • piping the file to a request to another service
  • piping the file to an AI model
  • making the file on the disk however the user wants.

Having another DownloadToWriter method that accepts any kind of io.Writer will help users skip an extra step to save on disk and read from the disk.

arshamalh added a commit to arshamalh/tbb that referenced this pull request Oct 12, 2026
Bot.Download always writes to a local path. A bot that only relays a
file (to object storage, another service, a model) had to write it to
disk and read it back. DownloadToWriter streams the file straight into
any io.Writer.

Brought over from tucnak/telebot#704, which was never merged upstream,
and tested against a fake file server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址