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

Function fetch_compressed_object

bridge/src/client/data_store/ftp/lib.rs:110–123  ·  view source on GitHub ↗
(
    credentials: &FtpCredentials,
    file_name: &str,
    file_path: Option<&str>,
)

Source from the content-addressed store, hash-verified

108}
109
110pub async fn fetch_compressed_object(
111 credentials: &FtpCredentials,
112 file_name: &str,
113 file_path: Option<&str>,
114) -> Result<(Vec<u8>, usize), String> {
115 let response = get_object(credentials, file_name, file_path).await;
116 match response {
117 Ok(buffer) => {
118 let size = buffer.len();
119 Ok((decompress(&buffer).map_err(err_to_string)?, size))
120 }
121 Err(err) => Err(format!("Failed to get json file: {}", err)),
122 }
123}
124
125pub async fn upload_compressed_object(
126 credentials: &FtpCredentials,

Callers 2

Calls 3

get_objectFunction · 0.85
decompressFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected