writer.endSync()


  • 返回:<number> 总共写入的字节数,如果结束无法同步完成,则为 -1。

writer.end() 的同步变体。返回值 -1 意味着关闭已开始,但需要异步清空。使用尝试回退模式来等待完成:

🌐 Synchronous variant of writer.end(). A return value of -1 means closing has started but requires asynchronous draining. Use the try-fallback pattern to await completion:

const result = writer.endSync();
if (result < 0) {
  writer.end();
}