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.
5 More HTML5 APIs You Didn’t Know Existed
The HTML5 revolution has provided us some awesome JavaScript and HTML APIs. Some are APIs we knew we’ve needed for years, others are cutting edge mobile and desktop helpers. Regardless of API strength or purpose, anything to help us better do our job is a…
Vibration API
Many of the new APIs provided to us by browser vendors are more targeted toward the mobile user than the desktop user. One of those simple APIs the Vibration API. The Vibration API allows developers to direct the device, using JavaScript, to vibrate in…
DWRequest: MooTools 1.2 AJAX Listener & Message Display
Though MooTools 1.2 is in its second beta stage, its basic syntax and theory changes have been hashed out. The JavaScript library continues to improve and become more flexible. Fellow DZone Zone Leader Boyan Kostadinov wrote a very useful article detailing how you can add a…
[ad_2]
Source link