pub struct FileUtils;Expand description
File utilities for proxy operations.
Implementations§
Source§impl FileUtils
impl FileUtils
Sourcepub fn calculate_hash(path: &Path) -> Result<String>
pub fn calculate_hash(path: &Path) -> Result<String>
Sourcepub fn format_file_size(bytes: u64) -> String
pub fn format_file_size(bytes: u64) -> String
Get file size in human-readable format.
Sourcepub fn get_modification_time(path: &Path) -> Result<i64>
pub fn get_modification_time(path: &Path) -> Result<i64>
Get file modification time as Unix timestamp.
§Errors
Returns an error if the file metadata cannot be read.
Sourcepub fn copy_with_progress<F>(
source: &Path,
destination: &Path,
progress_callback: F,
) -> Result<u64>
pub fn copy_with_progress<F>( source: &Path, destination: &Path, progress_callback: F, ) -> Result<u64>
Copy file with progress tracking.
Sourcepub fn ensure_directory(path: &Path) -> Result<()>
pub fn ensure_directory(path: &Path) -> Result<()>
Create directory if it doesn’t exist.
Sourcepub fn get_available_space(_path: &Path) -> Result<u64>
pub fn get_available_space(_path: &Path) -> Result<u64>
Sourcepub fn is_video_file(path: &Path) -> bool
pub fn is_video_file(path: &Path) -> bool
Check if file is a video file based on extension.
Sourcepub fn guess_codec_from_extension(path: &Path) -> Option<String>
pub fn guess_codec_from_extension(path: &Path) -> Option<String>
Get codec name from file extension.
Auto Trait Implementations§
impl Freeze for FileUtils
impl RefUnwindSafe for FileUtils
impl Send for FileUtils
impl Sync for FileUtils
impl Unpin for FileUtils
impl UnsafeUnpin for FileUtils
impl UnwindSafe for FileUtils
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more