Move files and folders to the trash
Works on macOS, Linux, and Windows.
$ npm install trash
const trash = ;;
Accepts paths and glob patterns.
Enable globbing when matching file paths.
To install the
trash command, run:
$ npm install --global trash-cli
But I can do the same thing with
Not really. The
mv command isn't cross-platform and moving to trash is not just about moving the file to a "trash" directory. On all OSes you'll run into file conflicts. The user won't easily be able to restore the file. It won't work on an external drive. The trash directory location varies between Windows versions. For Linux, there's a whole spec you need to follow. On macOS, you'll lose the Put back feature.
MIT © Sindre Sorhus