writable._writev(chunks, callback)


  • chunks <Object[]> 要写入的数据。该值是一个包含 <Object> 的数组,每个元素表示要写入的一个独立数据块。这些对象的属性如下:
    • chunk <Buffer> | <string> 一个包含要写入数据的缓冲实例或字符串。如果 Writable 是通过将 decodeStrings 选项设置为 false 并向 write() 传递了一个字符串来创建的,那么 chunk 将是一个字符串。
    • encoding <string> chunk 的字符编码。如果 chunk 是一个 Buffer,那么 encoding 将会是 'buffer'
  • callback <Function> 一个回调函数(可选带有错误参数),将在提供的块处理完成时被调用。

此函数绝对不能被应用代码直接调用。它应由子类实现,并且仅由内部的 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.