Struct rust_web_server::ext::file_ext::FileExt
source · pub struct FileExt;
Implementations§
source§impl FileExt
impl FileExt
pub fn read_file_partially(
filepath: &str,
range: &Range
) -> Result<Vec<u8>, String>
pub fn read_file(filepath: &str) -> Result<Vec<u8>, String>
pub fn file_modified_utc(filepath: &str) -> Result<u128, String>
pub fn get_static_filepath(request_uri: &str) -> Result<String, String>
pub fn does_file_exist(path: &str) -> bool
sourcepub fn is_symlink(path: &str) -> Result<bool, String>
pub fn is_symlink(path: &str) -> Result<bool, String>
Checks if the file is symlink
Examples
use rust_web_server::ext::file_ext::FileExt;
#[test]
fn link_points_to() {
let path = "test/index_rewrite";
let is_symlink = FileExt::is_symlink(path).unwrap();
assert!(is_symlink);
}
sourcepub fn symlink_points_to(path: &str) -> Result<String, String>
pub fn symlink_points_to(path: &str) -> Result<String, String>
Returns path to a file, symlink points to
Examples
use rust_web_server::ext::file_ext::FileExt;
#[test]
fn link_points_to() {
let path = "test/index_rewrite";
let points_to = FileExt::symlink_points_to(path).unwrap();
assert_eq!("index.html", points_to);
}