writable._writev(chunks, callback)


  • chunks <Object[]> 要写入的数据。 该值是 <Object> 数组,每个数组表示要写入的离散数据块。 这些对象的属性是:
    • chunk <Buffer> | <string> 包含要写入的数据的缓冲区实例或字符串。 如果 Writable 是在 decodeStrings 选项设置为 false 的情况下创建的,并且字符串已传给 write(),则 chunk 将是字符串。
    • encoding <string> chunk 的字符编码。 如果 chunkBuffer,则 encoding 将是 'buffer'
  • callback <Function> 当对提供的块的处理完成时要调用的回调函数(可选地带有错误参数)。

此函数不得由应用程序代码直接调用。 它应该由子类实现,并且只能由内部 Writable 类方法调用。

writable._writev() 方法可以在能够同时处理多个数据块的流实现中作为 writable._write() 的补充或替代来实现。 如果实现并且有来自先前写入的缓冲数据,则将调用 _writev() 而不是 _write()

writable._writev() 方法以下划线为前缀,因为它是定义它的类的内部方法,不应由用户程序直接调用。

  • chunks <Object[]> The data to be written. The value is an array of <Object> that each represent a discrete chunk of data to write. The properties of these objects are:
    • chunk <Buffer> | <string> A buffer instance or string containing the data to be written. The chunk will be a string if the Writable was created with the decodeStrings option set to false and a string was passed to write().
    • encoding <string> The character encoding of the chunk. If chunk is a Buffer, the encoding will be 'buffer'.
  • callback <Function> A callback function (optionally with an error argument) to be invoked when processing is complete for the supplied chunks.

This function MUST NOT be called by application code directly. It should be implemented by child classes, and called by the internal Writable class methods only.

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().

The writable._writev() method is prefixed with an underscore because it is internal to the class that defines it, and should never be called directly by user programs.