https://github.com/sunsided/async-tempfile-rs
Automatically deleted async I/O temporary files in Rust
https://github.com/sunsided/async-tempfile-rs
async-io rust temporary-files tokio
Last synced: 2 months ago
JSON representation
Automatically deleted async I/O temporary files in Rust
- Host: GitHub
- URL: https://github.com/sunsided/async-tempfile-rs
- Owner: sunsided
- License: mit
- Created: 2022-10-21T23:30:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-22T06:36:18.000Z (3 months ago)
- Last Synced: 2025-03-01T12:19:55.513Z (3 months ago)
- Topics: async-io, rust, temporary-files, tokio
- Language: Rust
- Homepage: https://crates.io/crates/async-tempfile
- Size: 123 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# async-tempfile
[](https://crates.io/crates/async-tempfile)
[](https://crates.io/crates/async-tempfile)

[](https://docs.rs/async-tempfile/)
[](https://codecov.io/gh/sunsided/async-tempfile-rs)Provides the `TempFile` struct, an asynchronous wrapper based on `tokio::fs`
for temporary files that will be automatically deleted when the last reference to
the struct is dropped.```rust
use async_tempfile::TempFile;#[tokio::main]
async fn main() {
let parent = TempFile::new().await.unwrap();// The cloned reference will not delete the file when dropped.
{
let nested = parent.open_rw().await.unwrap();
assert_eq!(nested.file_path(), parent.file_path());
assert!(nested.file_path().is_file());
}// The file still exists; it will be deleted when `parent` is dropped.
assert!(parent.file_path().is_file());
}
```