A cross-platform Node.js module to safely move files and folders to the system trash instead of permanently deleting them.
Trash is a Node.js module that moves files and directories to the system trash instead of permanently deleting them. It solves the problem of irreversible file deletion by providing a safer, cross-platform alternative to commands like `fs.unlink` or `del`.
Node.js developers who need to safely delete files in applications, scripts, or CLI tools across macOS, Windows, and Linux environments.
Developers choose Trash for its cross-platform reliability, safety features, and ease of integration, avoiding the complexities of manually handling OS-specific trash implementations.
Move files and directories to the trash
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Works seamlessly on macOS, Linux, and Windows, using OS-specific trash handlers like `macos-trash` and `recycle-bin` to ensure reversible deletion across environments.
Accepts glob patterns for batch file operations, with an option to disable globbing, making it versatile for matching multiple files in scripts.
Non-existent files and empty glob matches are ignored without throwing errors, reducing boilerplate code for edge cases in file management.
Offers a clean, async API as shown in the README's usage example, making integration straightforward in modern Node.js applications.
The README explicitly warns that the Linux implementation is 'not very good and not maintained,' potentially leading to bugs or lack of support for future Linux updates.
When running as a service account, files go to an inaccessible system recycle bin, causing clutter without user visibility, as noted in the FAQ.
The API silently ignores non-existent paths, so developers must manually check file existence to confirm trashing, adding extra steps for verification.