Crates.io | delete |
lib.rs | delete |
version | 1.0.1 |
source | src |
created_at | 2021-07-01 13:03:09.530684 |
updated_at | 2021-07-01 14:51:24.072757 |
description | Fast, easy deletion of files and folders with async and cross-platform support. |
homepage | |
repository | https://github.com/XtremeDevX/delete |
max_upload_size | |
id | 417433 |
size | 10,385 |
This crate allows for fast and easy deletion of files and folders. It has async
and cross-platform support.
Many of the functions in this crate directly call std::fs
and tokio::fs
.
This crate aims to be:
use delete::{delete_file};
fn main() {
// Delete file.txt
delete_file("file.txt").unwrap();
}
use delete::{delete_folder};
fn main() {
// Delete tests folder
delete_folder("tests").unwrap();
}
use delete::{delete_file_async};
#[tokio::main]
async fn main() {
// Delete file.txt asynchronously
delete_file_async("file.txt").await.unwrap();
}
use delete::{delete_folder_async};
#[tokio::main]
async fn main() {
// Delete tests folder asynchronously
delete_folder_async("tests").await.unwrap();
}
use delete::{rapid_delete_dir_all};
#[tokio::main]
async fn main() {
// 2-3x faster than std::fs::remove_dir_all
// removes all files and folders in subfolders recursively using tokio workers
rapid_delete_dir_all("node_modules", None, None).await;
}