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

exiv2-wasm

v0.5.13

Published

Exiv2 in the browser via WebAssembly (read/write EXIF/IPTC/XMP).

Readme

exiv2-wasm

🇰🇷 Read this in Korean: README.ko.md

Use Exiv2 in the browser via WebAssembly.
A tiny C++ wrapper (embind) exposes simple functions to read/write EXIF / IPTC / XMP.
Minimal deps are built for wasm (expat, brotli dec/common, inih); zlib comes from the Emscripten port.


Online Demo


Project structure

exiv2-wasm/
├─ exiv2/           # submodule (Exiv2)
├─ libexpat/        # submodule (expat)
├─ brotli/          # submodule (google/brotli)
├─ inih/            # submodule (benhoyt/inih)
├─ scripts/
│  ├─ build.ps1     # Windows PowerShell build
│  └─ build.bash    # Linux/macOS bash build
├─ wrapper.cpp      # embind wrapper (read/write metadata)
├─ index.html       # demo UI page
├─ dist/            # build outputs: exiv2.js / exiv2.wasm
└─ (build/, deps/)  # build cache / installed deps (git-ignored)

Clone with submodules:

git clone --recurse-submodules https://github.com/gerosyab/exiv2-wasm.git

Prerequisites

Tools

  • CMake, Ninja
  • Emscripten SDK (emcmake / emcc / em++ / emar)

Windows (PowerShell)

winget install Kitware.CMake
winget install Ninja-build.Ninja

Linux (Debian/Ubuntu)

sudo apt update
sudo apt install -y cmake ninja-build python3

Emscripten SDK (all OS)

# anywhere you like
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest

# new shell(s):
source ./emsdk_env.sh      # Linux/macOS
# or on Windows PowerShell:
# .\emsdk_env.ps1

Re-run emsdk_env.sh / emsdk_env.ps1 in each new shell.


Build

Windows (PowerShell)

cd exiv2-wasm
# one-session policy (optional)
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

# clean build
.\scripts\build.ps1 -Clean
# incremental build
.\scripts\build.ps1

Linux/macOS (bash/zsh)

cd exiv2-wasm
chmod +x scripts/build.bash

# clean build
./scripts/build.bash -c
# incremental build
./scripts/build.bash

Outputs: dist/exiv2.js and dist/exiv2.wasm


Run the demo

# from project root
python -m http.server 8080
# open:
# http://localhost:8080/index.html

JavaScript usage

Wrapper API:

  • read(u8: Uint8Array) -> { exif: Object, iptc: Object, xmp: Object }
  • readTagText(u8, key: string) -> string | null
  • readTagBytes(u8, key: string) -> Uint8Array | null
  • writeString(u8, key: string, value: string) -> Uint8Array (returns new buffer)
  • writeBytes(u8, key: string, data: Uint8Array) -> Uint8Array

Browser (CDN + <script> global function)

<script src="https://unpkg.com/exiv2-wasm"></script>
<script>
  (async () => {
    const exiv2 = await createExiv2Module();

    async function fileToU8(file) {
      const buf = await file.arrayBuffer();
      return new Uint8Array(buf);
    }

    document.querySelector('#file').addEventListener('change', async (e) => {
      const u8 = await fileToU8(e.target.files[0]);
      const meta = exiv2.read(u8);
      console.log('Camera Model:', meta.exif['Exif.Image.Model']);
    });
  })();
</script>
<input id="file" type="file" accept="image/*">

Browser (CDN + ESM import)

<script type="module">
  import { createExiv2Module } from 'https://cdn.jsdelivr.net/npm/exiv2-wasm/+esm';

  const exiv2 = await createExiv2Module();

  const input = document.querySelector('#file');
  input.addEventListener('change', async (e) => {
    const file = e.target.files[0];
    const buf = new Uint8Array(await file.arrayBuffer());
    const meta = exiv2.read(buf);
    console.log('Camera Model:', meta.exif['Exif.Image.Model']);
  });
</script>
<input id="file" type="file" accept="image/*">

ESM (Node.js / Vite / webpack / Rollup)

import { createExiv2Module } from 'exiv2-wasm';

const exiv2 = await createExiv2Module();

const fs = await import('fs/promises');
const u8 = new Uint8Array(await fs.readFile('image.jpg'));
const meta = exiv2.read(u8);
console.log('Model:', meta.exif['Exif.Image.Model']);

CommonJS

const { createExiv2Module } = require('exiv2-wasm');
const fs = require('fs');

function fileToU8(path) {
  return new Uint8Array(fs.readFileSync(path));
}

createExiv2Module().then((exiv2) => {
  const u8 = fileToU8('image.jpg');
  const meta = exiv2.read(u8);
  console.log('Model:', meta.exif['Exif.Image.Model']);
});

Common keys (examples)

  • Camera: Exif.Image.Make, Exif.Image.Model
  • Exposure: Exif.Photo.ExposureTime, Exif.Photo.ShutterSpeedValue
  • Aperture: Exif.Photo.FNumber, Exif.Photo.ApertureValue
  • ISO: Exif.Photo.PhotographicSensitivity (or Exif.Photo.ISOSpeedRatings)
  • Title/Author/Comment:
    • XMP: Xmp.dc.title, Xmp.dc.creator, Xmp.dc.description
    • EXIF: Exif.Image.ImageDescription, Exif.Image.Artist, Exif.Photo.UserComment
    • Windows XP Unicode*: Exif.Image.XPTitle, Exif.Image.XPAuthor, Exif.Image.XPComment (UTF-16LE)

Notes

  • Exiv2 CLI build is disabled: -DEXIV2_BUILD_EXIV2_COMMAND=OFF
  • BMFF/HEIF support enabled: -DEXIV2_ENABLE_BMFF=ON
  • If submodules show empty after clone:
    git submodule update --init --recursive