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