Command Line trash
One of the first commands you learn when experimenting with command line is rm
, the utility for deleting files and directories. Deletion is a core computer UI operation but operating systems use a "Trash" paradigm, where files are stored before truly deleted. With the rm
utility, however, files are immediately, permanently deleted.
If you're like me and afraid to automate permanent file deletion, you can opt for a utility named trash
. This nice Node.js library moves files to the trash instead of instant deletion.
// Install with `yarn add trash`
// Move a file to trash
const trash = require('trash');
await trash('bug-report.jpg');
There's also a trash-cli
package for using the utility from command line:
yarn add trash-cli
# Usage
trash unicorn.png rainbow.png
trash '*.png' '!unicorn.png'
rm
can be really harsh so having a trash
utility is helpful in providing users a file deletion paradigm that they're used to.
While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready? Promises are becoming a big part of the JavaScript world...
My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...
I was recently checking out Google Plus because they implement some awesome effects. I opened the console and same the following message:
WARNING!
Using this console may allow attackers to impersonate you and steal your information using an attack called Self-XSS.
Do not enter or paste code that you...
We all know that we can set a link's :hover color, but what if we want to add a bit more dynamism and flair? jQuery allows you to not only animate to a specified color, but also allows you to animate to a random color.
The...
Hej David, there is even a shell alternative if you prefer to stick to the tools you already have like me. Just write down this simple function