#temp-dir #temp #clash #async #async-write-ext

tmpdir

Useful to create temp directories and copy their contents on completion of some action. Tmp dirs will be created using [env::temp_dir] with some random characters prefixed to prevent a name clash

1 stable release

1.0.0 Feb 24, 2023

#1349 in Filesystem

Download history 406/week @ 2024-12-15 111/week @ 2024-12-22 154/week @ 2024-12-29 441/week @ 2025-01-05 715/week @ 2025-01-12 498/week @ 2025-01-19 966/week @ 2025-01-26 417/week @ 2025-02-02 382/week @ 2025-02-09 475/week @ 2025-02-16 434/week @ 2025-02-23 390/week @ 2025-03-02 209/week @ 2025-03-09 580/week @ 2025-03-16 1162/week @ 2025-03-23 518/week @ 2025-03-30

2,482 downloads per month
Used in 4 crates

MIT license

12KB
164 lines

TmpDir

Useful to create temp directories and copying their contents on completion of some action. Tmp dirs will be created using env::temp_dir with some random characters prefixed to prevent a name clash

copy will traverse recursively through a directory and copy all file contents to some destination dir. It will not follow symlinks.

Example

use tmpdir::TmpDir;
use tokio::{fs, io::AsyncWriteExt};

let tmp = TmpDir::new("foo").await.unwrap();
let new_tmp = TmpDir::new("bar").await.unwrap();

new_tmp.copy(tmp.as_ref()).await;
new_tmp.close().await; // not necessary to explicitly call

Dependencies

~3–9MB
~71K SLoC