pub fn abs_path_to_url_string(
path: impl AsRef<Path>,
) -> Result<String, CloudFileError>
Expand description
Given a local file’s absolute path, return a URL string to that file.
§Example
use cloud_file::abs_path_to_url_string;
// Define a sample file_name and expected_url based on the target OS
#[cfg(target_os = "windows")]
let (file_name, expected_url) = (r"M:\data files\small.bed", "file:///M:/data%20files/small.bed");
#[cfg(not(target_os = "windows"))]
let (file_name, expected_url) = (r"/data files/small.bed", "file:///data%20files/small.bed");
let url = abs_path_to_url_string(file_name)?;
assert_eq!(url, expected_url);