/// Updates the content of a file on Drive. The MIME type is guessed appropriately based on the
/// content.
Updates the content of a file on Drive. The MIME type is guessed appropriately based on the
content.
Updates the content of a file on Drive . The MIME type is guessed appropriately based on the content .
fn update_file_content(
        &mut self,
        id: DriveId,
        data: &[u8],
    ) -> Result<(Response, drive3::File), Error> {
        let mime_guess = data.sniff_mime_type().unwrap_or("application/octet-stream");
        debug!(
            "Updating file content for {}. Mime type guess based on content: {}",
            &id, &mime_guess
        );
        let mut file = drive3::File::default();
        file.mime_type = Some(mime_guess.to_string());
        self.hub
            .files()
            .update(file, &id)
            .add_scope(drive3::Scope::Full)
            .upload_resumable(DummyFile::new(data), mime_guess.parse().unwrap())
            .map_err(|e| err_msg(format!("{:#?}", e)))
    }
fn update_file_content ( & mut self , id : DriveId , data : & [ u8 ] , ) -> Result < ( Response , drive3 :: File ) , Error > { let mime_guess = data . sniff_mime_type ( ) . unwrap_or ( " " ) ; debug ! ( " " id mime_guess ) ; let mut file = drive3 :: File :: default ( ) ; file . mime_type = Some ( mime_guess . to_string ( ) ) ; self . hub . files ( ) . update ( file , & id ) . add_scope ( drive3 :: Scope :: Full ) . upload_resumable ( DummyFile :: new ( data ) , mime_guess . parse ( ) . unwrap ( ) ) . map_err ( | e | err_msg ( format ! ( " " e ) ) ) }
Updates the content of a file on Drive.
Updates the content of a file on Drive .
&mut self
id
DriveId
data
&[u8]