fs_metadata

Crates.iofs_metadata
lib.rsfs_metadata
version0.3.2
sourcesrc
created_at2023-07-15 17:14:37.971184
updated_at2024-10-31 19:59:45.843723
descriptionA wrapper around Rust API for getting file metadata
homepagehttps://github.com/andrewgremlich/media_organizer
repositoryhttps://github.com/andrewgremlich/media_organizer
max_upload_size
id917313
size9,844
Andrew Gremlich (andrewgremlich)

documentation

https://github.com/andrewgremlich/media_organizer/blob/master/fs_metadata/readme.md

README

FS Metadata

A cross-platform simple wrapper to get metadata of a file.

  1. Access SystemTime as readable dates.
  2. Get the permissions of a file.
  3. Get human readable file sizes.

Functions

Favor the Struct version instead.

pub fn file_created(path_str: &str) -> Result<String, String>

pub fn file_modified(path_str: &str) -> Result<String, String>

pub fn last_accessed(path_str: &str) -> Result<String, String>

Struct

struct FileMetadata {
    pub created: String,
    pub modified: String,
    pub accessed: String,
    pub is_file_read_only: bool,
    pub is_dir: bool,
    pub is_file: bool,
    pub is_readable: bool,
    pub is_writable: bool,
    pub is_executable: bool,
}

FileMetadata {
    fn new(path_str: &'static str) -> Result<Self, String>;
    fn readable(&self) -> bool;
    fn writable(&self) -> bool;
    fn executable(&self) -> bool;
    fn get_file_in_kilobytes(&self) -> f32;
    fn get_file_in_megabytes(&self) -> f32;
    fn get_file_in_gigabytes(&self) -> f32;
    fn get_file_in_terabytes(&self) -> f32;
}

Run Tests

To activate the tests, run cargo test -p fs_metadata.

Commit count: 74

cargo fmt