0

I am developing a nodejs application in which I have a http server who responds to incoming POST commands. I do need to return an entire binary file. I can do it by using

response.end(file, 'binary); // where 'file' is the entire byte array

but I don't want to store the whole file in memory, I do want to send it by chunks. Is there any other way for doing this? I have googled without success.

Thanks in advance,

Didac Perez Parera
  • 3,734
  • 3
  • 52
  • 87

1 Answers1

1

You can use response.write(...) to send chunks. See here: http://nodejs.org/api/http.html#http_response_write_chunk_encoding

Also, some additonal help in sending chunked responses can be found here: Node.js: chunked transfer encoding

Community
  • 1
  • 1
olan
  • 3,568
  • 5
  • 24
  • 30