A secure, cross-platform Rust library for creating temporary files with support for multiple independent references.
tempfile is a Rust library for creating and managing temporary files securely across multiple platforms. It solves the problem of safe temporary file creation and automatic cleanup, while also enabling multiple independent references to the same file for advanced use cases like producer/consumer patterns.
Rust developers who need reliable, cross-platform temporary file handling in their applications, particularly those working with file I/O, data processing, or inter-process communication.
Developers choose tempfile for its strong security guarantees, automatic cleanup, unique support for multiple file references, and comprehensive cross-platform compatibility, which simplifies a traditionally error-prone aspect of filesystem programming.
Temporary file library for rust
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Files are automatically deleted when the last reference is dropped, preventing data leaks, as emphasized in the README's security focus.
Supports major operating systems like Linux, Windows, macOS, and niche platforms such as RedoxOS and WASI, ensuring broad portability.
Allows securely opening multiple independent handles to the same temporary file, a unique feature useful for producer/consumer patterns, as highlighted in the documentation.
Active CI, clear versioning on crates.io, and comprehensive documentation indicate reliable maintenance and ease of use.
On WASI P1/P2, you must explicitly set a temporary directory with `tempfile::env::override_temp_dir` or face panics, and Android may require similar manual configuration.
For WebAssembly targets, the library only supports build and link without filesystem operations, making it ineffective for browser-based applications needing temporary storage.
Android, RedoxOS, Wasm, and WASI targets require the latest stable Rust compiler, which can hinder projects with fixed or legacy toolchains.