zipFile.addEntry(entry)


  • entry ZipEntry
  • 返回:<Promise> 充满了 entry。

在当前中央目录开始的位置写入 entry,然后重写中央目录以包含它,替换任何同名的现有条目。如果 ZipFile 不是以 { writable: true } 打开的,则抛出 ERR_ZIP_NOT_WRITABLE。

🌐 Writes entry where the central directory currently starts, then rewrites the central directory to include it, replacing any existing entry of the same name. Throws ERR_ZIP_NOT_WRITABLE if the ZipFile was not opened with { writable: true }.

返回的(相同的)entry 保持可读:用 zlib.ZipEntry.createStream() 创建的流式条目,本来序列化一次就会被消耗,现在就地升级为指向刚写入副本的文件支持条目(在这个 ZipFile 打开时有效)。内存中的条目保持自己的缓冲区不变。

🌐 The returned (same) entry is left readable: a streaming entry created with zlib.ZipEntry.createStream(), which would otherwise be spent once serialized, is promoted in place to a file-backed entry pointing at the copy just written (valid while this ZipFile is open). In-memory entries keep their own buffer unchanged.