1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-12-17 19:55:49 +00:00

files downloading improvements

This commit is contained in:
2021-08-09 19:55:08 +06:00
parent 8dbdbdee13
commit abc0457a36
5 changed files with 72 additions and 5 deletions

View File

@@ -9,6 +9,7 @@ fun PathedFile.asStream(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
): InputStream = URL(this.fullUrl(telegramAPIUrlsKeeper)).openStream()
@Deprecated("This api will be removed soon. Use `downloadFile` instead")
fun PathedFile.asFile(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
dest: File = File.createTempFile(this.fileUniqueId, this.filename),
@@ -22,6 +23,7 @@ fun PathedFile.asFile(
return dest
}
@Deprecated("This api will be removed soon. Use `downloadFile` instead")
fun PathedFile.asBytes(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
): ByteArray = this.asStream(telegramAPIUrlsKeeper)