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,

4

1 回答 1

1

您可以使用 response.write(...) 发送块。见这里:http ://nodejs.org/api/http.html#http_response_write_chunk_encoding

此外,可以在此处找到发送分块响应的一些附加帮助: Node.js:分块传输编码

于 2013-09-18T16:22:04.267 回答