diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 6faa509..8a3768f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -361,6 +361,18 @@ namespace WTelegram return thumbSize == null ? document.mime_type : "image/" + fileType; } + /// Download a document from Telegram into the outputStream + /// The document to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the animated photo. Use photo.LargestVideoSize to download the largest version of the animated photo + /// (optional) Callback for tracking the progression of the transfer + /// MIME type of the document/thumbnail + public async Task DownloadFileAsync(Document document, Stream outputStream, VideoSize videoSize, ProgressCallback progress = null) + { + var fileLocation = document.ToFileLocation(videoSize); + return await DownloadFileAsync(fileLocation, outputStream, document.dc_id, videoSize.size, progress); + } + /// Download a file from Telegram into the outputStream /// Telegram file identifier, typically obtained with a .ToFileLocation() call /// Stream to write file content to. This method does not close/dispose the stream