{"id":18323,"library":"exif-component","title":"exif-component","description":"Client-side EXIF parser for JPEG/TIFF images. Version 1.0.1 is the latest release. This is a fork of ExifReader with a simplified API, designed specifically for the Component package manager (not npm). It extracts metadata tags from an ArrayBuffer input. The package has not been updated since 2014 and targets legacy browser and Node.js environments. For modern usage, consider using the original ExifReader or exifr.","status":"deprecated","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","exif","image","png","jpg","jpeg","meta"],"install":[{"cmd":"npm install exif-component","lang":"bash","label":"npm"},{"cmd":"yarn add exif-component","lang":"bash","label":"yarn"},{"cmd":"pnpm add exif-component","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses CommonJS and is not ESM-compatible. Default export is a function.","wrong":"import exif from 'exif-component';","symbol":"exif","correct":"const exif = require('exif-component');"},{"note":"Named import is incorrect; the package exports a single function directly.","wrong":"import { exif } from 'exif-component';","symbol":"exif","correct":"const { exif } = require('exif-component');"}],"quickstart":{"code":"const fs = require('fs');\nconst exif = require('exif-component');\n\n// Read an image file as buffer\nconst buffer = fs.readFileSync('image.jpg');\n// Convert to ArrayBuffer\nconst arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);\n// Parse EXIF\ntry {\n  const tags = exif(arrayBuffer);\n  console.log(JSON.stringify(tags, null, 2));\n} catch (err) {\n  console.error('Failed to parse EXIF:', err.message);\n}","lang":"javascript","description":"Reads a JPEG file, converts the Node.js Buffer to an ArrayBuffer, and parses EXIF tags using the exif function."},"warnings":[{"fix":"Use exifr (https://www.npmjs.com/package/exifr) or ExifReader (https://www.npmjs.com/package/exifreader) instead.","message":"This package is a fork of ExifReader with a simplified API but has not been updated since 2014. Consider using the original ExifReader or exifr for modern applications.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Install using component install component/exif or directly from GitHub. Alternatively, migrate to an npm-published EXIF library.","message":"This package uses the Component package manager, not npm. Installation via npm will not work as expected.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength) to convert a Node.js Buffer to an ArrayBuffer.","message":"The library expects an ArrayBuffer, not a Buffer or Blob. Node.js users must convert Buffer to ArrayBuffer manually.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use const exif = require('exif-component'); instead of import { exif } from 'exif-component'; or import exif from 'exif-component';.","cause":"Incorrect import style: using named import or ES import syntax on a CommonJS module that exports a single function.","error":"TypeError: exif is not a function"},{"fix":"Convert Buffer to ArrayBuffer before calling exif: const arrayBuffer = buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);","cause":"Passing a Node.js Buffer or plain string instead of an ArrayBuffer.","error":"Error: First argument must be an ArrayBuffer"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}