zlib.setMaxZipContentSize(size)


稳定性: 1.0 - 早期开发

ZIP 压缩档案 API 是实验性的。第一次使用它的任何部分(包括这个函数)都会发出实验性警告;仅仅导入 node:zlib 不会。

🌐 The ZIP archive API is experimental. Using any part of it (this function among them) emits an experimental warning the first time; merely importing node:zlib does not.

当没有给出明确的 maxSize 选项时,设置 zipEntry.content() 使用的默认上限。这是为了防止压缩炸弹:如果归档的中央目录声明某个成员大于此值,会在为其分配内存之前被拒绝。流式读取(zipEntry.contentIterator()、zipFile.stream())本身就是设计为有限内存的,不会受到此设置的影响。

🌐 Sets the default ceiling used by zipEntry.content() when no explicit maxSize option is given. This is a guard against zip bombs: an archive whose central directory declares a member larger than this is rejected before allocating memory for it. Streaming reads (zipEntry.contentIterator(), zipFile.stream()) are bounded-memory by design and are not affected by this setting.