MCPcopy Create free account
hub / github.com/BitVM/BitVM / upload_compressed_object

Method upload_compressed_object

bridge/src/client/data_store/aws_s3.rs:186–201  ·  view source on GitHub ↗
(
        &self,
        file_name: &str,
        contents: &Vec<u8>,
        file_path: Option<&str>,
    )

Source from the content-addressed store, hash-verified

184 }
185
186 async fn upload_compressed_object(
187 &self,
188 file_name: &str,
189 contents: &Vec<u8>,
190 file_path: Option<&str>,
191 ) -> Result<usize, String> {
192 let compressed_data =
193 compress(contents, DEFAULT_COMPRESSION_LEVEL).map_err(err_to_string)?;
194 let size = compressed_data.len();
195 let byte_stream = ByteStream::from(compressed_data);
196
197 match self.upload_object(file_name, byte_stream, file_path).await {
198 Ok(_) => Ok(size),
199 Err(err) => Err(format!("Failed to save json file: {}", err)),
200 }
201 }
202}

Callers

nothing calls this directly

Calls 3

lenMethod · 0.80
compressFunction · 0.50
upload_objectMethod · 0.45

Tested by

no test coverage detected