(binaryData)
| 57813 | }; |
| 57814 | } |
| 57815 | function getJpegMetadata(binaryData) { |
| 57816 | var dataView = toDataView(binaryData); |
| 57817 | var isJpeg = dataView.byteLength >= 3 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 && dataView.getUint8(2) === 0xff; |
| 57818 | if (!isJpeg) return null; |
| 57819 | var _getJpegMarkers = getJpegMarkers(), tableMarkers = _getJpegMarkers.tableMarkers, sofMarkers = _getJpegMarkers.sofMarkers; |
| 57820 | var i = 2; |
| 57821 | while(i + 9 < dataView.byteLength){ |
| 57822 | var marker = dataView.getUint16(i, BIG_ENDIAN); |
| 57823 | if (sofMarkers.has(marker)) return { |
| 57824 | mimeType: "image/jpeg", |
| 57825 | height: dataView.getUint16(i + 5, BIG_ENDIAN), |
| 57826 | width: dataView.getUint16(i + 7, BIG_ENDIAN) |
| 57827 | }; |
| 57828 | if (!tableMarkers.has(marker)) return null; |
| 57829 | i += 2; |
| 57830 | i += dataView.getUint16(i, BIG_ENDIAN); |
| 57831 | } |
| 57832 | return null; |
| 57833 | } |
| 57834 | function getJpegMarkers() { |
| 57835 | var tableMarkers = new Set([ |
| 57836 | 0xffdb, |
no test coverage detected