(writer, fileEntry, readRanges, options = {})
| 3799 | } |
| 3800 | |
| 3801 | async getData(writer, fileEntry, readRanges, options = {}) { |
| 3802 | const zipEntry = this; |
| 3803 | const { |
| 3804 | reader, |
| 3805 | offset, |
| 3806 | diskNumberStart, |
| 3807 | extraFieldAES, |
| 3808 | extraFieldZip64, |
| 3809 | compressionMethod, |
| 3810 | config, |
| 3811 | bitFlag, |
| 3812 | signature, |
| 3813 | rawLastModDate, |
| 3814 | uncompressedSize, |
| 3815 | compressedSize |
| 3816 | } = zipEntry; |
| 3817 | const { |
| 3818 | dataDescriptor |
| 3819 | } = bitFlag; |
| 3820 | const localDirectory = fileEntry.localDirectory = {}; |
| 3821 | const dataArray = await readUint8Array(reader, offset, HEADER_SIZE, diskNumberStart); |
| 3822 | const dataView = getDataView$1(dataArray); |
| 3823 | let password = getOptionValue$1(zipEntry, options, OPTION_PASSWORD); |
| 3824 | let rawPassword = getOptionValue$1(zipEntry, options, OPTION_RAW_PASSWORD); |
| 3825 | const passThrough = getOptionValue$1(zipEntry, options, OPTION_PASS_THROUGH); |
| 3826 | password = password && password.length && password; |
| 3827 | rawPassword = rawPassword && rawPassword.length && rawPassword; |
| 3828 | if (extraFieldAES) { |
| 3829 | if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) { |
| 3830 | throw new Error(ERR_UNSUPPORTED_COMPRESSION); |
| 3831 | } |
| 3832 | } |
| 3833 | if ((compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE && compressionMethod != COMPRESSION_METHOD_DEFLATE_64) && !passThrough) { |
| 3834 | throw new Error(ERR_UNSUPPORTED_COMPRESSION); |
| 3835 | } |
| 3836 | if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) { |
| 3837 | throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND); |
| 3838 | } |
| 3839 | readCommonHeader(localDirectory, dataView, 4); |
| 3840 | const { |
| 3841 | extraFieldLength, |
| 3842 | filenameLength, |
| 3843 | lastAccessDate, |
| 3844 | creationDate |
| 3845 | } = localDirectory; |
| 3846 | localDirectory.rawExtraField = extraFieldLength ? |
| 3847 | await readUint8Array(reader, offset + HEADER_SIZE + filenameLength, extraFieldLength, diskNumberStart) : |
| 3848 | new Uint8Array(); |
| 3849 | readCommonFooter(zipEntry, localDirectory, dataView, 4, true); |
| 3850 | Object.assign(fileEntry, { lastAccessDate, creationDate }); |
| 3851 | const encrypted = zipEntry.encrypted && localDirectory.encrypted && !passThrough; |
| 3852 | const zipCrypto = encrypted && !extraFieldAES; |
| 3853 | if (!passThrough) { |
| 3854 | fileEntry.zipCrypto = zipCrypto; |
| 3855 | } |
| 3856 | if (encrypted) { |
| 3857 | if (!zipCrypto && extraFieldAES.strength === UNDEFINED_VALUE) { |
| 3858 | throw new Error(ERR_UNSUPPORTED_ENCRYPTION); |
nothing calls this directly
no test coverage detected