writer.endSync()
- 返回:<number> 总共写入的字节数,如果结束无法同步完成,则为
-1。
writer.end() 的同步版本。返回值 -1 仅表示操作无法同步完成;不能对关闭是否已开始或为什么无法完成做任何假设。使用尝试-回退模式来等待完成:
🌐 Synchronous variant of writer.end(). A return value of -1 only indicates
that the operation could not complete synchronously; no assumption can be made
about whether closing has started or why it could not complete. Use the
try-fallback pattern to await completion:
const result = writer.endSync();
if (result < 0) {
writer.end();
}