静态方法:zlib.ZipEntry.create(filename, data[, options])
🌐 Static method: zlib.ZipEntry.create(filename, data[, options])
filename<string> 档案中的条目名称。结尾的/表示这是一个目录条目。data<Buffer> | <TypedArray> | <DataView> | <ArrayBuffer> 条目的完整、未压缩内容。当filename指向一个目录时,必须为空。options<Object>- 返回:<Promise> 充满了ZipEntry。
压缩 data(除非 method 是 'store',或者压缩不会减小它的大小)并计算它的 CRC-32。
🌐 Compresses data (unless method is 'store', or compression would not
reduce its size) and computes its CRC-32.
当条目最终以未压缩的形式存储时(因为 method 是 'store',或者压缩不会减小大小),条目会保留 data 的零拷贝视图,而不是复制,而且它的 CRC-32 已经被记录。创建条目后不要修改 data;如果可能会改变的话,请传一个副本。
🌐 When the entry ends up stored uncompressed (because method is 'store',
or because compression would not reduce the size), the entry retains a
zero-copy view of data rather than a copy, and its CRC-32 has already been
recorded. Do not mutate data after creating the entry; pass a copy if it
might change.
ZIP 用在 modified 的 MS-DOS 日期/时间字段的分辨率是 2 秒,而且没有时区。当 modified 不在完整的 2 秒边界上时,还会写入一个 Info-ZIP 扩展时间戳额外字段,记录完整的(UTC)秒,以便时间能更准确地回传(见 zipEntry.modified)。这适用于每一个条目的创建路径。
🌐 The MS-DOS date/time fields ZIP uses for modified have 2-second resolution
and no time zone. When modified does not fall on a whole 2-second
boundary, an Info-ZIP extended-timestamp extra field is written as well,
recording the whole (UTC) second so the time round-trips more precisely (see
zipEntry.modified). This applies to every entry-creation path.