easy_file

Crates.ioeasy_file
lib.rseasy_file
version0.1.20
sourcesrc
created_at2022-06-19 05:01:39.770145
updated_at2022-08-17 09:33:36.958642
descriptioneasy file system
homepage
repositoryhttps://gitlab.com/andrew_ryan/easy_file
max_upload_size
id608821
size10,801
zinso (zinso)

documentation

https://docs.rs/easy_file/

README

easty file system


use easy_file::*;
fn main() {
    
// create file and write data
match  create_write_file!(std::path::Path::new("./demo.txt"),"demo".as_bytes()){
    Ok(_r)=>{
        println!("done");
    },
    Err(_e)=>{}
}

// read file return Result<Vec<u8>, Box<dyn std::error::Error>>
match  read_file!("./demo.txt"){
    Ok(_r)=>{
        println!("{:?}",_r);
    },
    Err(_e)=>{}
}


// remove file or folder
match  remove!("./test.txt"){
     Ok(_r)=>{
         println!("done");
     },
     Err(_e)=>{}
}

// list directory return Vec<PathBuf>
match  list_dir!("./"){
     Ok(_r)=>{
         println!("{:?}",r);
     },
     Err(_e)=>{}
}

//append data to file
match append_to_file!("./foo.txt", "demo".as_bytes()) {
    Ok(_r) => {
            println!("done");
    }
    Err(_e) => {}
}

//read text file return String
if let Ok(_r) = read_to_string!("./foo.txt") {
        println!("{}", _r);
}

// copy file from a path to another path
if let Ok(_r) = copy_to_path!("./src/foo.txt", "./demo.txt") {}

// move file from a path to another path
if let Ok(_r) = move_to_path!("./src/foo.txt", "./demo.txt") {}

// Creates a new, empty directory at the provided path
if let Ok(_r) = create_dir!("./demo") {}
    
// Recursively create a directory and all of its parent components if they are missing.
if let Ok(_r) = create_dir_all!("./rust/js") {}



}


Commit count: 19

cargo fmt