@wasmedia/wexiftool
v0.2.2
Published
Run ExifTool in the browser and Node.js via WebAssembly
Maintainers
Readme
wexiftool
Run the real, full-featured ExifTool in the browser and Node.js — no server required.
wexiftool compiles Perl 5.40 to WebAssembly via Emscripten and bundles Phil Harvey's ExifTool into the WASM virtual filesystem. This gives you the complete ExifTool (read and write support for 400+ metadata formats) as a JavaScript/TypeScript library.
CLI Usage
Use it just like native exiftool — no Perl installation required:
# Install globally
npm install -g @wasmedia/wexiftool
# Or use directly with npx
npx @wasmedia/wexiftool photo.jpg
npx @wasmedia/wexiftool -Artist="Jane Doe" photo.jpg
npx @wasmedia/wexiftool -json -G *.jpg
npx @wasmedia/wexiftool -verAll standard exiftool flags and options work as expected.
API Usage
import { WExifTool } from '@wasmedia/wexiftool';
const wexiftool = await WExifTool.create();
// Read metadata
const metadata = await wexiftool.read(file); // File, Blob, ArrayBuffer, or Uint8Array
// Write metadata
const modified = await wexiftool.write(file, {
Artist: 'Jane Doe',
Copyright: '2026 Jane Doe',
});
// Pass arbitrary exiftool flags
const raw = await wexiftool.readRaw(file, ['-G', '-s']);
// Run any exiftool command (low-level)
const result = await wexiftool.exec(['-json', '-G'], files);
wexiftool.destroy(); // Free WASM memoryInstall
npm install @wasmedia/wexiftool
# or
pnpm add @wasmedia/wexiftoolA standalone UMD bundle with inlined WASM is also available for <script> tag usage at https://exiftool.wasmedia.org/wexiftool.standalone.js (see Standalone Bundle). It's ~70MB and not part of the npm package; the npm package, which loads the WASM separately, is recommended for production.
Demo
A playground demo is available where you can drop an image to read and edit its metadata entirely client-side. Deployed via GitLab Pages.
How It Works
- Perl 5.40 is cross-compiled to WASM using Emscripten inside a Docker container
- ExifTool's Perl modules are embedded into the Emscripten virtual filesystem (MEMFS)
- Image data is written into MEMFS, ExifTool processes it via
callMain(), results are extracted - A TypeScript API wraps the low-level Emscripten interface with a clean async interface
Building from Source
Requires Docker.
pnpm install
pnpm run build:wasm # Builds Perl + ExifTool WASM (Docker, ~10-15 min first time)
pnpm run build # Builds the JS/TS library
pnpm run dev # Launches the demo playground dev server
pnpm test # Runs testsSize
The WASM payload is approximately 53MB uncompressed (~13MB gzipped). The library lazy-loads the WASM on first use.
Status
End-to-end functional: exiftool -ver returns the version, EXIF metadata reads from a real JPEG fixture, and EXIF tag writes round-trip through WExifTool.write() → WExifTool.read(). The currently statically-linked XS set is File::Glob (more in build/build-xs-extensions.sh); ExifTool's read and most-of-write paths are pure Perl and work with what libperl.a already provides.
Build is single-threaded by design (usethreads=undef, usemultiplicity=undef) and uses no dynamic loading (usedl=undef).
Known issue: writing EXIF:Copyright (tag ID 0x8298) silently corrupts the IFD entry — verified that the resulting file is unreadable by both wexiftool and native exiftool. All other EXIF tags tested round-trip correctly. Suspected signed-vs-unsigned 16-bit arithmetic on the tag ID inside ExifTool's WASM build. See CHANGELOG.md Known Issues.
Contributing
Contributions welcome — see CONTRIBUTING.md for setup, project layout, and PR guidelines. Notable changes are tracked in CHANGELOG.md.
License
MIT
This project bundles ExifTool by Phil Harvey, which is licensed under the Perl Artistic License / GPL. See LICENSE-exiftool for details.
