| 1169 | |
| 1170 | // Writes stored or compressed body bytes |
| 1171 | data(chunks: ReadonlyArray<Uint8Array>): void { |
| 1172 | const { header, record } = this.current! |
| 1173 | for (const chunk of chunks) { |
| 1174 | this.push(chunk) |
| 1175 | record.compressedSize += chunk.length |
| 1176 | } |
| 1177 | const size = header.type === "Directory" ? 0 : header.size |
| 1178 | if (size !== undefined && record.size > size) throw sizeMismatch(header.path, record.size, size) |
| 1179 | if (!record.zip64 && record.compressedSize >= MAX32) { |
| 1180 | throw new ZipError({ |
| 1181 | kind: "SizeMismatch", |
| 1182 | message: `compressed data of ${JSON.stringify(header.path)} reached 4 GiB, ` + |
| 1183 | `but its local header has no ZIP64 sizes` |
| 1184 | }) |
| 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | end(): void { |
| 1189 | const { descriptor, header, record } = this.current! |