writable._writev(chunks, callback)


  • chunks <Object[]> 要写入的数据。该值是一个 <Object> 数组,每个数组代表要写入的离散数据块。这些对象的属性是:

    ¥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> 包含要写入的数据的缓冲区实例或字符串。如果创建 Writable 时将 decodeStrings 选项设置为 false 并将字符串传递给 write(),则 chunk 将是一个字符串。

      ¥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> chunk 的字符编码。如果 chunkBuffer,则 encoding 将是 'buffer'

      ¥encoding <string> The character encoding of the chunk. If chunk is a Buffer, the encoding will be 'buffer'.

  • callback <Function> 当对提供的块的处理完成时要调用的回调函数(可选地带有错误参数)。

    ¥callback <Function> A callback function (optionally with an error argument) to be invoked when processing is complete for the supplied chunks.

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

¥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.

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

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

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

¥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.