Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alibasiccoder/fs-pro-rust
working with files easily
https://github.com/alibasiccoder/fs-pro-rust
filesystem rust
Last synced: 20 days ago
JSON representation
working with files easily
- Host: GitHub
- URL: https://github.com/alibasiccoder/fs-pro-rust
- Owner: AliBasicCoder
- License: mit
- Created: 2020-10-23T11:16:46.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-01-15T17:53:42.000Z (about 4 years ago)
- Last Synced: 2024-12-28T04:46:37.647Z (about 2 months ago)
- Topics: filesystem, rust
- Language: Rust
- Homepage: https://docs.rs/fs_pro
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fs pro
> A library to work with files easily
![crates.io](https://img.shields.io/crates/v/fs_pro.svg)
![Crates.io](https://img.shields.io/crates/d/fs_pro)the is a beta rust version of [fs-pro](https://github.com/AliBasicCoder/fs-pro)
see the full docs [here](https://docs.rs/fs_pro)
## Features
- you don't have to work with std api's
- easy to use## Usage
```rust
use fs_pro::{Dir, File, Shape, error::Result};#[derive(Shape)]
struct ChildShapedDir {
#[name = "child_file.txt"]
child_file: File
// ...
}#[derive(Shape)]
struct MyShapedDir {
#[name = "my_file.txt"]
my_file: File,
#[pattern = "*.txt"]
my_dir: Dir,
child_shaped_dir: ChildShapedDir
}fn main() -> Result<()> {
let file = File::new("my_file.txt");
// create the file
file.create();
// write to file
file.write("hello there");
// read file
file.read_to_string(); // => "hello there"
// and much more...
let dir = Dir::new("my_dir");
// create the dir
dir.create();
// create a file in it
dir.create_file("my_file.txt").unwrap().write("hello world");
// create a dir in it
dir.create_dir("my_dir");let shape: Shape = Shape::new();
let shape_inst = shape.create_at("target").unwrap();
println!("{:?}", shape_inst.my_file); // File
println!("{:?}", shape_inst.my_dir); // Dir
println!("{:?}", shape_inst.child_shaped_dir.child_file); // File// and much more...
Ok(())
}
```## rust features
- json: adds method json on File
## Licence
Copyright (c) 2020 AliBasicCoder