FileKtx - libtd-ktx

Kotlin Coroutines extensions for Telegram API TDLib (Telegram Database library)


libtd-ktx / kotlinx.telegram.extensions / FileKtx

FileKtx

interface FileKtx : BaseKtx

Interface for access TdApi.File extension functions. Can be used alongside with other extension interfaces of the package. Must contain TelegramFlow instance field to access its functionality

Properties

api Instance of the TelegramFlow connecting extensions to the Telegram Clientabstract val api: TelegramFlow

Functions

cancelDownload Suspend function, which stops the downloading of a file. If a file has already been downloaded, does nothing.open suspend fun File.cancelDownload(onlyIfPending: Boolean): Unit
cancelUpload Suspend function, which stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined.open suspend fun File.cancelUpload(): Unit
delete Suspend function, which deletes a file from the TDLib file cache.open suspend fun File.delete(): Unit
download Suspend function, which downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates.open suspend fun File.download(priority: Int, offset: Int, limit: Int, synchronous: Boolean): File
get Suspend function, which returns information about a file; this is an offline request.open suspend fun File.get(): File
getAttachedStickerSets Suspend function, which returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets.open suspend fun File.getAttachedStickerSets(): StickerSets
getDownloadedPrefixSize Suspend function, which returns file downloaded prefix size from a given offset.open suspend fun File.getDownloadedPrefixSize(offset: Int): Count
readPart Suspend function, which reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the client has no direct access to TDLib’s file system, because it is usually slower than a direct read from the file.open suspend fun File.readPart(offset: Int, count: Int): FilePart

Inheritors

TelegramKtx Interface for access all Telegram objects extension functions. Contains 182 extensionsinterface TelegramKtx : BasicGroupKtx, CallKtx, ChatKtx, FileKtx, MessageKtx, NotificationGroupKtx, ProxyKtx, SecretChatKtx, SupergroupKtx, UserKtx, CommonKtx