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

Function fetch_object

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

Source from the content-addressed store, hash-verified

74}
75
76pub async fn fetch_object(
77 credentials: &FtpCredentials,
78 file_name: &str,
79 file_path: Option<&str>,
80) -> Result<String, String> {
81 let response = get_object(credentials, file_name, file_path).await;
82 match response {
83 Ok(buffer) => {
84 let json = String::from_utf8(buffer);
85 match json {
86 Ok(json) => Ok(json),
87 Err(err) => Err(format!("Failed to parse json: {}", err)),
88 }
89 }
90 Err(err) => Err(format!("Failed to get json file: {}", err)),
91 }
92}
93
94pub async fn upload_object(
95 credentials: &FtpCredentials,

Callers 2

fetch_objectMethod · 0.85
fetch_objectMethod · 0.85

Calls 1

get_objectFunction · 0.85

Tested by

no test coverage detected