A cross-platform Node.js module to empty the system trash/recycle bin programmatically.
empty-trash is a Node.js module that allows developers to programmatically empty the system trash or recycle bin. It solves the problem of needing to clear deleted files from different operating systems' trash systems through a unified JavaScript API.
Node.js developers building applications that need to manage system files or perform cleanup operations, particularly those creating cross-platform desktop apps or system utilities.
Developers choose empty-trash because it provides a simple, reliable way to handle a system-level task across all major platforms without dealing with platform-specific complexities or permission issues.
Empty 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.
Handles macOS, Linux, and Windows with platform-specific methods like AppleScript and XDG compliance, ensuring consistent operation across different operating systems.
On macOS, it uses AppleScript to bypass permission issues common with other approaches, making it reliable for user-level tasks without admin rights.
Provides a single asynchronous function call, as shown in the README, allowing developers to empty the trash with just one line of code.
Follows the XDG specification on Linux for proper trash management, ensuring compatibility with standard desktop environments and reducing bugs.
Only empties the entire trash bin with no option to delete specific files, limiting its utility for applications that require fine-grained control over trash contents.
Relies on AppleScript on macOS and the empty-recycle-bin module on Windows, which could fail if these tools are missing or misconfigured, adding potential points of failure.
Offers only an asynchronous API, which might complicate integration in synchronous workflows or require extra error-handling code for scenarios needing immediate feedback.