writable._final(callback)


  • callback <Function> 完成写入任何剩余数据后调用此函数(可选地带有错误参数)。

不得直接调用 _final() 方法。 它可以由子类实现,如果是,则只能由内部 Writable 类方法调用。

这个可选函数将在流关闭之前被调用,将 'finish' 事件延迟到 callback 被调用。 这对于在流结束之前关闭资源或写入缓冲数据很有用。

  • callback <Function> Call this function (optionally with an error argument) when finished writing any remaining data.

The _final() method must not be called directly. It may be implemented by child classes, and if so, will be called by the internal Writable class methods only.

This optional function will be called before the stream closes, delaying the 'finish' event until callback is called. This is useful to close resources or write buffered data before a stream ends.