yagop / node-telegram-bot-api

Telegram Bot API for NodeJS
MIT License
8.35k stars 1.52k forks source link

custom output name on bot.downloadFile #1068

Open kyzsuukii opened 1 year ago

kyzsuukii commented 1 year ago

How can I set the output filename when using

bot.downloadFile

similar to

bot.downloadFile(fileId, savePath, 'output.jpg')

??

ronak2898 commented 8 months ago

There are four method to download file which are

image

bot.getFileLink and bot.getFile would give downloaded able link and file object then you have to use axios or https to download and save with custom name

bot.downloadFile won't allow you to download file with custom name where as you can only pass downloadDir so if you want to use you have change name after download using fs.renameSync

bot.getFileStream would give you direct file stream in which you could directly save file with custom name.

image