0

I have a local ip that other computers can connect to my local server.

My problem is when I downloaded a file that file is downloaded to the local server. How can I download a files that I save on my local server to my current other computer.

Any module that is available will do.

Nodejs and javascript only.

Thanks in advance.

Lep
  • 21
  • 2
  • 9
  • This has little to do with node and more to do with File sharing (like setting up a Samba file share for example). If one computer can see the files on the other computer *as if it were part of the same local file system*, then node can handle transferring files just fine to and from each computer. – TKoL Feb 11 '19 at 10:52
  • I tried some fs method but it still downloading the file on the local server instead of other computer that is connected to local server. I found a module called multer but i'm confuse how it works. I'm still studying how it works. Hoping that you heard that module in node.js – Lep Feb 12 '19 at 02:13

1 Answers1

0

You need to have a client (the computer which is initiating the transfer) and a server (the computer you are transferring the file to).

(You can also do it the other way around, where the client initiates the transfer by asking the server for the file, and then gets the file in the response, but that isn't what you are asking).

A typical way to do this using Node.js would be to have the server understand HTTP and for the client to make an HTTP request.

This question explains how to make an HTTP post request with an attached file which covers the needs of the client.

This question explains how to use Express.js to receive the file. You can then save it as normal in Node.js.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thanks for the info., have you heard the multer module in node js ? I can't understand some line in the modules but I think that might help me with my current problem. – Lep Feb 12 '19 at 02:10