4

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

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

2

No.

fs.unlink will use OS dependent functionality to remove file, and this is permanent, same as rm in linux.

There might be very complex options that are used by data recovery companies. But there is no such functionality in node natively.

Comments

1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.