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

Function list_objects

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

Source from the content-addressed store, hash-verified

39}
40
41pub async fn list_objects(
42 credentials: &FtpCredentials,
43 file_path: Option<&str>,
44) -> Result<Vec<String>, String> {
45 if credentials.is_secure {
46 match secure_connect(credentials).await {
47 Ok(mut ftp_stream) => match ftp_stream.nlst(file_path).await {
48 Ok(files) => {
49 disconnect(None, Some(&mut ftp_stream)).await;
50 Ok(files)
51 }
52 Err(err) => {
53 disconnect(None, Some(&mut ftp_stream)).await;
54 Err(format!("Unable to list objects: {}", err))
55 }
56 },
57 Err(err) => Err(format!("Unable to list objects: {}", err)),
58 }
59 } else {
60 match insecure_connect(credentials).await {
61 Ok(mut ftp_stream) => match ftp_stream.nlst(file_path).await {
62 Ok(files) => {
63 disconnect(Some(&mut ftp_stream), None).await;
64 Ok(files)
65 }
66 Err(err) => {
67 disconnect(Some(&mut ftp_stream), None).await;
68 Err(format!("Unable to list objects: {}", err))
69 }
70 },
71 Err(err) => Err(format!("Unable to list objects: {}", err)),
72 }
73 }
74}
75
76pub async fn fetch_object(
77 credentials: &FtpCredentials,

Callers 2

list_objectsMethod · 0.85
list_objectsMethod · 0.85

Calls 3

secure_connectFunction · 0.85
insecure_connectFunction · 0.85
disconnectFunction · 0.70

Tested by

no test coverage detected