(reader)
| 246 | #start; |
| 247 | |
| 248 | readExif(reader) { |
| 249 | const TIFF_MARKER = 0x2a; |
| 250 | const EXIF_IFD = 0x8769; |
| 251 | |
| 252 | this.#reader = reader; |
| 253 | this.#start = this.#reader.offset; |
| 254 | this.#readEndianness(); |
| 255 | |
| 256 | if (!this.#reader.read(2) === TIFF_MARKER) { |
| 257 | throw new Error("Invalid TIFF: Marker not found."); |
| 258 | } |
| 259 | |
| 260 | const dirOffset = this.#reader.read(4); |
| 261 | this.#reader.seek(this.#start + dirOffset, false); |
| 262 | |
| 263 | for (const t of this.#readTags()) { |
| 264 | if (t.id === EXIF_IFD) { |
| 265 | return this.#readExifTag(t); |
| 266 | } |
| 267 | } |
| 268 | throw new Error("No EXIF: TIFF Exif IFD tag not found"); |
| 269 | } |
| 270 | |
| 271 | #readUserComment(tag) { |
| 272 | this.#reader.seek(this.#start + tag.offset, false); |
no test coverage detected