-2

I've been working on a chat engine with file streaming builded with socket.io and nodejs. Everything is working well, messages, notifications, chat rooms and even the file streaming but let's say that we have a server with only 1TB (250gb HDDx4) and my app is instaled in C:/, my friends can upload files in the App directory with nodejs and the path to load that file in chat box is something like <img src="../.././private/filename.png"> . I don't know if it's the best method to do this but it's working.. Now let's say that we want to switch the partition for uploading in F:/, how can I load the file in chat box from there ? I can not put the absolute URL, e.g <img src="F:/private/filename.png"> because it will search in the client/user computer in F:/ partition, not in my server in F:/ partition.. It's someone that can recommand me some methods/solutions for doing this ?

  • I am not familar with node, but it certainly seems like there must be some way to configure an alias on the server that does something like map '/drvf/' -> 'F:'. – Zoredache Sep 12 '17 at 00:15

1 Answers1

0

I found two solutions for this problem.

  1. RAID method - can mirroring partitions in a single place.
  2. Storage server - using only the static files from given paths without any routes.

Structure: C:/private/stack/files D:/private/over/files F:/private/flow/files

Server:
app.use(express.static(path.join("C:/private")));
app.use(express.static(path.join("D:/private")));
app.use(express.static(path.join("F:/private")));

Access: http://localhost:2800/stack/files/f53f95f15306b5e9.jpg
Access: http://localhost:2800/over/files/8906b5e9597572839.png
Access: http://localhost:2800/flow/files/177fffa8b35508633.pdf