A Node.js utility for generating random temporary file and directory paths with automatic cleanup.
Tempy is a Node.js library that generates random temporary file and directory paths. It solves the problem of manually creating and managing temporary storage by providing a simple API that ensures unique paths and optional automatic cleanup. This is particularly useful for tasks like testing, file processing, or any operation requiring short-lived storage.
Node.js developers who need to work with temporary files in scripts, CLI tools, or applications, especially those focused on testing, build processes, or file manipulation.
Developers choose Tempy for its minimal API, reliability in generating non-conflicting paths, and built-in cleanup features. It reduces boilerplate code and prevents common issues like leftover temporary files, making file system operations safer and more efficient.
Get a random temporary file or directory path
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The API is straightforward with functions like temporaryFile() and temporaryDirectory(), reducing boilerplate code for temp path generation.
Methods like temporaryFileTask() automatically remove temporary files after the callback executes, preventing leftover files.
Supports custom extensions, filenames, prefixes, and parent/root directories, allowing organized temp storage as shown in the README examples.
Provides both synchronous (e.g., temporaryWriteSync) and promise-based methods, catering to different use cases in Node.js.
Using functions like temporaryFile() without a task requires developers to handle file deletion, risking orphaned files if cleanup is overlooked.
Tempy does not offer file locking mechanisms, so concurrent access must be managed externally to avoid data corruption.
It focuses on path generation and basic writes, lacking features like integrated streaming or advanced file system operations.