If we are talking about Node.js can share in its implementation.
But in General files are stored on the hash, ie if you have for example there is a file with the hash
then save it for example on the way
and in database write down what the file is and what it's for.
Resize or any other versions of the file can be stored so
This method avoids duplicates in the same folder to store unlimited number of files (with a large number of files in one folder, the operation speed of the file system to slow down)
This basis, next is the multi-server support, and various cache servers for files.