(options = {})
| 3530 | } |
| 3531 | |
| 3532 | async* getEntriesGenerator(options = {}) { |
| 3533 | const zipReader = this; |
| 3534 | let { reader } = zipReader; |
| 3535 | const { config } = zipReader; |
| 3536 | await initStream(reader); |
| 3537 | if (reader.size === UNDEFINED_VALUE || !reader.readUint8Array) { |
| 3538 | reader = new BlobReader(await new Response(reader.readable).blob()); |
| 3539 | await initStream(reader); |
| 3540 | } |
| 3541 | if (reader.size < END_OF_CENTRAL_DIR_LENGTH) { |
| 3542 | throw new Error(ERR_BAD_FORMAT); |
| 3543 | } |
| 3544 | reader.chunkSize = getChunkSize(config); |
| 3545 | const endOfDirectoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, reader.size, END_OF_CENTRAL_DIR_LENGTH, MAX_16_BITS * 16); |
| 3546 | if (!endOfDirectoryInfo) { |
| 3547 | const signatureArray = await readUint8Array(reader, 0, 4); |
| 3548 | const signatureView = getDataView$1(signatureArray); |
| 3549 | if (getUint32(signatureView) == SPLIT_ZIP_FILE_SIGNATURE) { |
| 3550 | throw new Error(ERR_SPLIT_ZIP_FILE); |
| 3551 | } else { |
| 3552 | throw new Error(ERR_EOCDR_NOT_FOUND); |
| 3553 | } |
| 3554 | } |
| 3555 | const endOfDirectoryView = getDataView$1(endOfDirectoryInfo); |
| 3556 | let directoryDataLength = getUint32(endOfDirectoryView, 12); |
| 3557 | let directoryDataOffset = getUint32(endOfDirectoryView, 16); |
| 3558 | const commentOffset = endOfDirectoryInfo.offset; |
| 3559 | const commentLength = getUint16(endOfDirectoryView, 20); |
| 3560 | const appendedDataOffset = commentOffset + END_OF_CENTRAL_DIR_LENGTH + commentLength; |
| 3561 | let lastDiskNumber = getUint16(endOfDirectoryView, 4); |
| 3562 | const expectedLastDiskNumber = reader.lastDiskNumber || 0; |
| 3563 | let diskNumber = getUint16(endOfDirectoryView, 6); |
| 3564 | let filesLength = getUint16(endOfDirectoryView, 8); |
| 3565 | let prependedDataLength = 0; |
| 3566 | let startOffset = 0; |
| 3567 | if (directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS || diskNumber == MAX_16_BITS) { |
| 3568 | const endOfDirectoryLocatorArray = await readUint8Array(reader, endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH); |
| 3569 | const endOfDirectoryLocatorView = getDataView$1(endOfDirectoryLocatorArray); |
| 3570 | if (getUint32(endOfDirectoryLocatorView, 0) == ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) { |
| 3571 | directoryDataOffset = getBigUint64(endOfDirectoryLocatorView, 8); |
| 3572 | let endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH, -1); |
| 3573 | let endOfDirectoryView = getDataView$1(endOfDirectoryArray); |
| 3574 | const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH - ZIP64_END_OF_CENTRAL_DIR_LENGTH; |
| 3575 | if (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) { |
| 3576 | const originalDirectoryDataOffset = directoryDataOffset; |
| 3577 | directoryDataOffset = expectedDirectoryDataOffset; |
| 3578 | if (directoryDataOffset > originalDirectoryDataOffset) { |
| 3579 | prependedDataLength = directoryDataOffset - originalDirectoryDataOffset; |
| 3580 | } |
| 3581 | endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH, -1); |
| 3582 | endOfDirectoryView = getDataView$1(endOfDirectoryArray); |
| 3583 | } |
| 3584 | if (getUint32(endOfDirectoryView, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) { |
| 3585 | throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND); |
| 3586 | } |
| 3587 | if (lastDiskNumber == MAX_16_BITS) { |
| 3588 | lastDiskNumber = getUint32(endOfDirectoryView, 16); |
| 3589 | } |
no test coverage detected