Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs: restore a deleted file with fs.unlink

Tags:

node.js

Is possible to restore files that has been removed with fs.unlink() or fs.unlinkSync()?

like image 647
nuragic Avatar asked Sep 17 '25 13:09

nuragic


1 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.

like image 181
user568109 Avatar answered Sep 19 '25 02:09

user568109