Is possible to restore files that has been removed with fs.unlink() or fs.unlinkSync()?
3 Answers
unlink is a system call in linux, the name comes from there. It deletes the file/folder entry or link from filesystem. It does not wipe out the file.
So is it possible to restore such files ? Yes. It is possible, but
Can you guranatee restoration ? No. The space occupied by file is released back to the system. So it can be written over by other processes.
Should you expect restoration ? No. It was not supposed to provide recycle bin like functionality. It is a low level method for programs to access filesystem.
Comments
If you asked how to do it in Node, the answer is: not natively.
You would have to write some C/C++ module to do this, as dealing with the disk in this way is veeery low level.
If you asked how to do it with desktop applications, the answer is: google it, there are lots of tools for this purpose.