Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can node.js send a file / folder to recycle bin (trash on MacOS) instead of fs.unlink / fs.rmdir?

Tags:

node.js

I couldn't find any info regarding this question.

Is there even a way for node.js to send a file / folder to bin instead of fs.unlink / fs.rmdir?

For example:

Can you do something like sendToBin(path) to send a file to recycle bin (Windows) trash (MacOS) instead of running fs.unlink() to remove file from disk (I know that it just marks it with 0)

like image 550
Un1 Avatar asked May 15 '18 12:05

Un1


1 Answers

Node.js's fs doesn't provide any api for moving files to Trash/Recycle Bin, but you can try trash node-module to have work-around.

like image 152
Mukesh Sharma Avatar answered Sep 20 '22 10:09

Mukesh Sharma