Sebastian Otto
Sebastian Otto

Reputation: 15289

sending files from node.js to node.js server

Whats the best way to send large files from one node.js server to another? We tried to encode it with base64 and send it over an allready existent tls socket connection, but the base64 string is to long so the socket splits it in several parts. We also thought to send it via http methods but that seems not the best way for us. Any ideas?

Upvotes: 0

Views: 539

Answers (1)

b_erb
b_erb

Reputation: 21261

Unless there are no special requirements, I'd use HTTP. HTTP cliens and servers are both available and rather mature in node.js, and HTTP gives you additional features (i.e. Caching, optimistic transactional behaviour, content negotiation, partial requests, etc.).

Don't roll your own protocol based on plain sockets, you are reinventing the wheel. But you might consider other protocols such as FTP as well.

Upvotes: 1

Related Questions