NodeJs : How to send very large data from server t

2019-04-15 11:47发布

问题:

I am using Express Framework. I am trying to send very large data from server. The Client receives 200 OK status but no data. Also it gives error ERR_CONTENT_LENGTH_MISMATCH even though I am sending the content-length Header from server. The content-length of my response is 2102619.

回答1:

Take a look at sending data in chunks and streams instead of everything at once.

https://medium.freecodecamp.org/node-js-streams-everything-you-need-to-know-c9141306be93 https://carlosrymer.com/using-node-streams-to-handle-large-file-uploads-24c1a0141b9c