| 1388 | } |
| 1389 | |
| 1390 | private check(current: Current, crc: number, compressedSize: number, size: number): void { |
| 1391 | if (current.actualCrc === crc && current.actualCompressedSize === compressedSize && current.actualSize === size) { |
| 1392 | return |
| 1393 | } |
| 1394 | const path = JSON.stringify(current.header.path) |
| 1395 | if (current.actualCrc !== crc) { |
| 1396 | throw new ZipError({ |
| 1397 | kind: "Checksum", |
| 1398 | message: `CRC-32 of ${path} is ${hex(current.actualCrc)}, but the archive records ${hex(crc)}` |
| 1399 | }) |
| 1400 | } |
| 1401 | throw new ZipError({ |
| 1402 | kind: "SizeMismatch", |
| 1403 | message: `${path} has ${current.actualSize} bytes (${current.actualCompressedSize} compressed), ` + |
| 1404 | `but the archive records ${size} (${compressedSize} compressed)` |
| 1405 | }) |
| 1406 | } |
| 1407 | |
| 1408 | // Reads a data descriptor, whose signature is optional and whose sizes are |
| 1409 | // 4 bytes unless the local header has a ZIP64 field. Writers that widen the |