writer.end([options])


  • options <Object>
    • signal <AbortSignal> 仅取消此操作。该信号仅取消挂起的 end() 调用;它不会使写入器本身失败。
  • 返回:<Promise> 返回写入的总字节数。

表示不会再写入更多数据。已经在等待缓冲区空间的写入会在流结束前按顺序完成,而之后的写入会失败。如果有未完成的数据,当消费者拉取 done: true 超过最后一批数据时,返回的 promise 会被解决。如果没有缓冲或待处理的数据,写入器会立即关闭。

🌐 Signals that no more data will be written. Writes already waiting for buffer space remain ordered before the end of the stream, while later writes fail. If data is outstanding, the returned promise fulfills after the consumer pulls done: true beyond the final batch. If no data is buffered or pending, the writer closes immediately.