MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / download_file_with_progress

Function download_file_with_progress

rust/src/collaboration/sync.rs:61–79  ·  view source on GitHub ↗

TODO: AsRef Download a file from its remote, saving all snapshots to a database in the specified location. Returns a FileContext for opening the file later. `file` - Remote File to download and open `db_path` - File path for saved database `progress` - Function to call for progress updates

(
    file: &RemoteFile,
    db_path: S,
    mut progress: F,
)

Source from the content-addressed store, hash-verified

59/// * `db_path` - File path for saved database
60/// * `progress` - Function to call for progress updates
61pub fn download_file_with_progress<S: BnStrCompatible, F: ProgressCallback>(
62 file: &RemoteFile,
63 db_path: S,
64 mut progress: F,
65) -> Result<Ref<FileMetadata>, ()> {
66 let db_path = db_path.into_bytes_with_nul();
67 let result = unsafe {
68 BNCollaborationDownloadFile(
69 file.handle.as_ptr(),
70 db_path.as_ref().as_ptr() as *const c_char,
71 Some(F::cb_progress_callback),
72 &mut progress as *mut F as *mut c_void,
73 )
74 };
75 let success = !result.is_null();
76 success
77 .then(|| unsafe { Ref::new(FileMetadata::from_raw(result)) })
78 .ok_or(())
79}
80
81/// Upload a file, with database, to the remote under the given project
82///

Callers 2

download_fileFunction · 0.85

Calls 2

into_bytes_with_nulMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected