Expand description
Fast, easy deletion of files and folders with async and cross-platform support.
§Overview
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:
- Fast
- Easy To Use
- Powerful
§Examples
§Non-Async Implementation
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();
}
§Async Implementation
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();
}
§Rapid Implementations
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 parallely using tokio workers
rapid_delete_dir_all("node_modules", None, None).await;
}
§Credits
Functions§
- delete_
file - Delete a file from the filesystem.
- delete_
file_ async - Delete a file from the filesystem using
async
andtokio
. - delete_
folder - Delete an empty folder from the filesystem.
- delete_
folder_ all - Delete a folder from the filesystem after recursively deleting all its contents.
- delete_
folder_ all_ async - Delete a folder from the filesystem after recursively deleting all its contents using
async
andtokio
. - delete_
folder_ async - Delete an empty folder from the filesystem using
async
andtokio
. - rapid_
delete_ dir_ all - Rapidly delete a folder from the filesystem after recursively deleting all its contents using
async
andtokio
.