Node.js 流:什么时候调用 _writev?

Node.js Streams: When will _writev Be Invoked?

Node.js 文档对可写流的 _writev 方法做了以下评论。

The writable._writev() method may be implemented in addition or alternatively to writable._write() in stream implementations that are capable of processing multiple chunks of data at once. If implemented and if there is buffered data from previous writes, _writev() will be called instead of _write().

强调我的。在什么情况下 Node.js 可写流可以缓冲以前写入的数据?

_writev 方法是否仅调用 after uncorking 已写入数据的软木塞流?或者是否存在其他情况,流可以从以前的写入中缓冲日期?如果您可以指出 Node.js 源代码中决定 w/r/t 调用 _write_writev.

的位置,则加分

_writev() 每当从流中缓冲了一条以上的数据并且函数已经定义时,就会被调用。使用 cork() 可能会 导致缓冲更多数据,但 so could slow processing.

守卫的代码_writevis in lib/internal/streams/writable.js. There is a buffer decision and then the guard for the write.