1use crate::fs::asyncify;
2
3use std::io;
4use std::path::Path;
5
6/// Removes a file from the filesystem.
7///
8/// Note that there is no guarantee that the file is immediately deleted (e.g.
9/// depending on platform, other open file descriptors may prevent immediate
10/// removal).
11///
12/// This is an async version of [`std::fs::remove_file`].
13pub async fn remove_file(path: impl AsRef<Path>) -> io::Result<()> {
14 let path: PathBuf = path.as_ref().to_owned();
15 asyncify(move || std::fs::remove_file(path)).await
16}
17