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

Method upload_compressed_object

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

Source from the content-addressed store, hash-verified

148 }
149
150 async fn upload_compressed_object(
151 &self,
152 file_name: &str,
153 contents: &Vec<u8>,
154 file_path: Option<&str>,
155 ) -> Result<usize, String> {
156 let compressed_data =
157 compress(contents, DEFAULT_COMPRESSION_LEVEL).map_err(err_to_string)?;
158 let size = compressed_data.len();
159
160 match self
161 .upload_object(file_name, compressed_data, file_path)
162 .await
163 {
164 Ok(_) => Ok(size),
165 Err(err) => Err(format!("Failed to save json file: {}", err)),
166 }
167 }
168}

Callers

nothing calls this directly

Calls 3

lenMethod · 0.80
compressFunction · 0.50
upload_objectMethod · 0.45

Tested by

no test coverage detected