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.
Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS. What we end up doing is repeating the same properties multiple times with each browser prefix. Yuck. Another thing we...
How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps?
This article serves as a point-by-point...
Last week I covered a smooth, subtle MooTools effect called Kwicks. Another great MooTools creation is the Accordion, which acts like...wait for it...an accordion! Now I've never been a huge Weird Al fan so this is as close to playing an accordion as...
The idea of image preloading has been around since the dawn of the internet. When we didn't have all the fancy stuff we use now, we were forced to use ugly mouseover images to show dynamism. I don't think you were declared an official...
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