pub async fn download_media<P: AsRef<Path>>(
        &self,
        media: &Media,
        path: P,
    ) -> Result<(), io::Error> {
        // Concurrent downloader
        if let Media::Document(document) = media {
            if document.size() as usize > BIG_FILE_SIZE {
                return self
                    .download_media_concurrent(media, path, WORKER_COUNT)
                    .await;
            }
        }

        let mut download = self.iter_download(media);
        Client::load(path, &mut download).await
    }
/// Downloads a media file into the specified path.
///
/// If the file already exists, it will be overwritten.
///
/// This is a small wrapper around [`Client::iter_download`] for the common case of
/// wanting to save the file locally.
///
/// # Examples
///
/// ```
/// # async fn f(media: grammers_client::types::Media, mut client: grammers_client::Client) -> Result<(), Box<dyn std::error::Error>> {
/// client.download_media(&media, "/home/username/photos/holidays.jpg").await?;
/// # Ok(())
/// # }
/// ```
Downloads a media file into the specified path.
If the file already exists, it will be overwritten.

This is a small wrapper around [`Client::iter_download`] for the common case of
wanting to save the file locally.
Downloads a media file into the specified path . If the file already exists it will be overwritten . This is a small wrapper around [ ` Client :: iter_download ` ] for the common case of wanting to save the file locally .
pub async fn download_media<P: AsRef<Path>>(
        &self,
        media: &Media,
        path: P,
    ) -> Result<(), io::Error> {
        // Concurrent downloader
        if let Media::Document(document) = media {
            if document.size() as usize > BIG_FILE_SIZE {
                return self
                    .download_media_concurrent(media, path, WORKER_COUNT)
                    .await;
            }
        }
        let mut download = self.iter_download(media);
        Client::load(path, &mut download).await
    }
pub async fn download_media < P : AsRef < Path > > ( & self , media : & Media , path : P , ) -> Result < ( ) , io :: Error > { // Concurrent downloader if let Media :: Document ( document ) = media { if document . size ( ) as usize > BIG_FILE_SIZE { return self . download_media_concurrent ( media , path , WORKER_COUNT ) . await ; } } let mut download = self . iter_download ( media ) ; Client :: load ( path , & mut download ) . await }
Downloads a media file into the specified path.
Downloads a media file into the specified path .
&self
media
&Media
path
P
&self
media
&Media
path
P
examples
None
async fn f(media: grammers_client::types::media, mut client: grammers_client::client) -> result<(), box<dyn std::error::error>> {
None
ok(())
None
}
None