Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Move files and folders to the trash
Works on OS X, Linux, and Windows.
In contrast to fs.unlink
, del
, and rimraf
which permanently delete files, this only moves them to the trash, which is much safer and reversible.
$ npm install --save trash
const trash = require('trash');
trash(['*.png', '!rainbow.png']).then(() => {
console.log('done');
});
You can use glob patterns.
To install the trash
command, run:
$ npm install --global trash-cli
On OS X, osx-trash
is used.
On Linux, the XDG spec is followed.
On Windows, recycle-bin
is used.
mv
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 OS X, you'll lose the Put back feature.
MIT © Sindre Sorhus
FAQs
Move files and folders to the trash
The npm package trash receives a total of 57,420 weekly downloads. As such, trash popularity was classified as popular.
We found that trash demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.