(
&self,
file_name: &str,
contents: &Vec<u8>,
file_path: Option<&str>,
)
| 245 | } |
| 246 | |
| 247 | async fn upload_compressed_object( |
| 248 | &self, |
| 249 | file_name: &str, |
| 250 | contents: &Vec<u8>, |
| 251 | file_path: Option<&str>, |
| 252 | ) -> Result<usize, String> { |
| 253 | let compressed_data = |
| 254 | compress(contents, DEFAULT_COMPRESSION_LEVEL).map_err(err_to_string)?; |
| 255 | let size = compressed_data.len(); |
| 256 | |
| 257 | println!("Writing data file to {} (size: {})", file_name, size); |
| 258 | |
| 259 | match self |
| 260 | .upload_object(file_name, compressed_data.as_slice(), file_path) |
| 261 | .await |
| 262 | { |
| 263 | Ok(_) => Ok(size), |
| 264 | Err(err) => Err(format!("Failed to save json file: {}", err)), |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | async fn test_connection(credentials: &SftpCredentials) -> Result<(), String> { |
no test coverage detected