我正在学习 nodejs
的 http
模块。我在 documentation 中找到了一个部分上面写着:
The interface is careful to never buffer entire requests or responses
这是否意味着该模块不能一次接收/发送整个请求/响应,而是分块接收/发送?
最佳答案
Does it means that this module is not capable of receiving / sending the whole request / response at once and it receives / sends in chunks instead?
没错:http
是基于流的,就像底层的 net
模块一样。
有很多模块可用于为您抽象这些流,并提供接收完整的响应(在内存中,所以要小心大响应)。例如,request
和 http.min
.
关于node.js - nodejs 的 http 模块不是可以一次接收/发送整个请求/响应吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53710463/