npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

exif-es6

v0.0.1

Published

JavaScript library for reading EXIF image metadata

Downloads

7

Readme

Exif-es6

Port the library exif-js in EcmaScript 2020

A JavaScript library for reading EXIF meta data from image files.

You can use it on images in the browser, either from an image or a file input element. Both EXIF and IPTC metadata are retrieved. This package can be used as a ES6 module.

Note: The EXIF standard applies only to .jpg and .tiff images. EXIF logic in this package is based on the EXIF standard v2.2 (JEITA CP-3451, included in this repo).

Install

Install exif-es6 through NPM:

npm install exif-es6 --save

Then you can import it in your JavaScript:

import {EXIF} from './node_modules/exif-es6/dist/exif-es6.js'

If you use TypeScript, you can import TypeScript-module in your own file:

import {EXIF} from "./node_modules/exif-es6/lib/exif-es6.(j|c)s"; // ← 
// which extension you use, depends on your TypeScript compiler/version etc.

There is no JavaScript Distribution in UMD form. If you need it, you can transpile the TypeScript files by yourself.

Usage

Exif data from a regular HTML img-Tag

  • JavaScript:
async function testNormalImageElement() {
    const img = document.getElementById("demo1");
    const imageInfo = await EXIF.getData(img);
    console.log('testNormalImageElement', EXIF.getAllTags(imageInfo));
    document.getElementById("demo1-exif").textContent = EXIF.pretty(imageInfo);
}
document.addEventListener('load', () => {
    testNormalImageElement();
})
  • HTML:
<img id="demo1" src="some-image.jpg" />
<pre id="demo1-exif"></pre>

Exif data from a HTML img-Tag with base64 src

  • JavaScript
async function testBase64Image() {
    const img = document.getElementById("demo2");
    const imageInfo = await EXIF.getData(img);
    console.log('testBase64Image', EXIF.getAllTags(imageInfo));
    document.getElementById("demo2-exif").textContent = EXIF.pretty(imageInfo);
}
document.addEventListener('load', () => {
    testBase64Image();
})
  • HTML
<img id="demo2" src="data:image/jpeg;base64, .... "/>
<pre id="demo2-exif"></pre>

Exif data from an Object URL

Example 1: Fetch an image over internet

async function testObjectUrl() {
    const src = 'dsc_09827.jpg';
    const response = await fetch(src, {method: "GET"});
    const blob = await response.blob();
    const objectUrl = URL.createObjectURL(blob);
    const testImage = new Image();
    testImage.src = objectUrl;
    const imageInfo = await EXIF.getData(testImage);
    console.log("testObjectUrl", EXIF.getAllTags(imageInfo) );
    document.getElementById("demo3-container").prepend(testImage);
    document.getElementById("demo3-exif").textContent = EXIF.pretty(imageInfo);
    // if we don't need objectUrl anymore, we can free memory from it
    URL.revokeObjectURL(objectUrl);
}
<div id="demo3-container">
    <pre id="demo3-exif"></pre>
</div>

Example 2: Uploaded image from user

  • JavaScript
function initTestUploadFile() {
    const fileSelect = document.getElementById("fileSelect");
    const fileElem = document.getElementById("fileElem");
    fileSelect.addEventListener("click", (e) => {
            if (fileElem) { fileElem.click(); }
            e.preventDefault(); // prevent navigating to href-address
        }
    );
    const createImgElement = (file) => {
        const img = document.createElement("img");
        img.classList.add("menu-image");
        img.src = URL.createObjectURL(file);
        return img;
    }
    fileElem.addEventListener("change", async (event) => {
        const files = event.target.files;
        if(files.length === 1) {
            const img = createImgElement(files[0]);
            const imageInfo = await EXIF.getData(img);
            console.log(EXIF.getAllTags(imageInfo));
            document.getElementById('demo4-container').prepend(img);
            document.getElementById('demo4-exif').textContent = EXIF.pretty(imageInfo)
        }
    });
}
document.addEventListener('load', () => {
    initTestUploadFile();
})
  • HTML
<input type="file" id="fileElem" accept="image/*" style="display:none" />
<a class="button-like" href="#" id="fileSelect">upload an image</a>
<div id="demo4-container">
    <pre id="demo4-exif"></pre>
</div>

Low-level

This library exposes experimentally three functions in module byte-seeker.ts. See API for their usage.

Caching

This library does not cache metadata (Exif, IPTC, if applicable Xmp) into the Image Element, as exif-js does.

If you need to cache the result, just do it in your code. One way to do it:

const img = document.getElementById("image");
const imgInfo = await EXIF.getData(img);
Object.assign(img, imgInfo); 

Now your img object has also three properties:

  • img.exifdata
  • img.iptcdata
  • img.xmpdata