tmpdir

Crates.iotmpdir
lib.rstmpdir
version1.0.0
sourcesrc
created_at2023-02-24 18:59:30.704312
updated_at2023-02-24 18:59:30.704312
descriptionUseful 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
homepage
repositoryhttps://github.com/bluecatengineering/tmpdir
max_upload_size
id793851
size14,653
Evan Cameron (leshow)

documentation

https://docs.rs/tmpdir

README

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
Commit count: 4

cargo fmt