Packages / rupm

rs-fs-temp 0.1.0

Temporary directories and files with unique names that are deleted when dropped

Install

cargo add rs-fs-temp --registry rupm

In Ruststudio: Packages, search for rs-fs-temp, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-fs-temp

Temporary directories and files with unique names that are deleted when dropped

Add it with `rupm add rs-fs-temp` (or `cargo add rs-fs-temp --registry rupm`).

```rust
use rs_fs_temp::{TempDir, TempFile};

let dir = TempDir::with_prefix("build")?;
std::fs::write(dir.join("a.txt"), "hello")?;
assert!(dir.path().is_dir());

let file = TempFile::with_contents(b"data")?;
assert_eq!(file.read_to_string()?, "data");

let path = dir.path().to_path_buf();
drop(dir);                // the directory and everything in it is removed
assert!(!path.exists());
```