Crates.io | ez_fs |
lib.rs | ez_fs |
version | 0.1.0 |
source | src |
created_at | 2023-08-08 01:41:02.506251 |
updated_at | 2023-08-08 01:41:02.506251 |
description | A filesystem simplification over the standard library |
homepage | |
repository | https://github.com/JamieH01/ez_fs |
max_upload_size | |
id | 938698 |
size | 18,117 |
ez_fs
is a Rust library that provides convenient abstractions for working with files and directories. It aims to simplify common file and directory operations by providing easy-to-use interfaces and utilities.
std::fs
types, providing a simplified and more ergonomic API.ez_fs
is meant to simplify a majority of use cases; if you need more specific features you should fall back to the std::fs
module.
Everything is prefixed with "Ez" to be unambiguous when using both ez_fs
and std::fs
.
//open file in write-only mode
let mut file = EzFile::create("foo.txt").unwrap();
file.write_all(b"bar").unwrap();
//change to read-only
file.to_read().unwrap();
let mut buf = String::new();
file.read_to_string(&mut buf).unwrap();
assert_eq!(buf, "bar");
//open an existing directory
let dir = EzDir::new(".", true).unwrap();
//recursively can subdirectories and collect all files
let files = dir.flatten_all();
for file in files {
println!("{file}")
}
ez_fs
was created due to my own personal frustrations. There are certain aspects such as simlinks that ive chosen to ignore.
My code certainly isnt perfect, so feel welcome to send an issue or PR!