https://github.com/alpheusday/get_dir.rs
An utility to get directory
https://github.com/alpheusday/get_dir.rs
dir directory file filesystem fs root rust
Last synced: 5 months ago
JSON representation
An utility to get directory
- Host: GitHub
- URL: https://github.com/alpheusday/get_dir.rs
- Owner: alpheustangs
- License: mit
- Created: 2024-09-26T15:25:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-07T19:46:22.000Z (about 1 year ago)
- Last Synced: 2024-11-07T20:36:55.574Z (about 1 year ago)
- Topics: dir, directory, file, filesystem, fs, root, rust
- Language: Rust
- Homepage: https://docs.rs/get_dir
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Get Dir
A utility to get directory.
This utility searches for a target directory by checking for any directories or files that match the provided input.
## Installation
To install this package, run the following command:
```bash
cargo add get_dir
```
## Usage
Get directory by target with the following code:
```rust
use get_dir::{
GetDir,
Target,
DirTarget,
};
GetDir::new()
.targets(vec![
Target::Dir(DirTarget {
name: "src",
}),
])
.run();
```
Or get directory by target in reverse with the following code:
```rust
use get_dir::{
GetDir,
Target,
FileTarget,
};
GetDir::new()
.targets(vec![
Target::File(FileTarget {
name: "LICENSE",
}),
])
.run_reverse();
```
Async version also available with `async_std` and `tokio` features:
```rust
use get_dir::{
GetDir,
Target,
DirTarget,
// async_std
async_std::GetDirAsyncExt,
// tokio
tokio::GetDirAsyncExt,
};
GetDir::new()
.targets(vec![
Target::Dir(DirTarget {
name: "src",
}),
])
.run_async()
.await;
```
## License
This project is licensed under the terms of the MIT license.