Go library that runs ExifTool in-process: embedded Perl via zeroperl (Perl compiled to WebAssembly), executed with wazero. You do not need a system exiftool binary or a separate Perl install.
Upstream ExifTool (Phil Harvey) and metadata: exiftool.org, exiftool/exiftool.
- Self-contained — Perl stdlib, ExifTool, and the interpreter ship inside the module (
embed/). - Same behavior everywhere — one WASM stack on Linux, macOS, Windows, etc.
- Trade-off — cold start is heavy (on the order of ~7–10 seconds to compile/instantiate WASM and init Perl). For many operations, use
NewServerandServer.Commandso ExifTool stays open (-stay_open) and work is amortized.
- Go 1.26+
- Dependency:
github.com/tetratelabs/wazero(seego.mod).
// One-shot: paths are relative to the process working directory.
out, err := exiftool.Command(nil, "-json", "photo.jpg")
// Explicit tree at /work (e.g. tests or isolated FS).
out, err := exiftool.Run(ctx, os.DirFS("/path/to/photos"), "-json", "/work/photo.jpg")
// Batch: one WASM/Perl startup, many commands.
e, err := exiftool.NewServer("-fast")
if err != nil { /* ... */ }
defer e.Shutdown()
out, err = e.Command("-Artist", "photo.jpg")Package docs, API details, and filesystem semantics (Command vs Run, temp dir, Arg1 / Config): run go doc -all or open pkg.go.dev.
go test ./... -timeout 10m # includes WASM tests; allow several minutesThe WASM module, Perl install prefix, and minified ExifTool script come from zeroperl. Follow that repository’s Build section (Docker or Apple Container): build the image, run the container, and copy /artifacts into a host directory (as shown there, e.g. ./output/).
From the build output directory, install these into this repo under embed/:
| Artifact from zeroperl output | Path in go-exiftool |
|---|---|
zeroperl.wasm |
embed/zeroperl.wasm |
perl-wasi-prefix/ (entire tree) |
embed/perl-wasi-prefix/ |
exiftool.min.pl |
embed/exiftool.min.pl |
Use the zeroperl.wasm artifact (reactor with asyncify) unless you intentionally switch runtimes. If you disable ExifTool in zeroperl (BUILD_EXIFTOOL=false), you must supply exiftool.min.pl yourself.
zeroperl’s README also documents build arguments (PERL_VERSION, EXIFTOOL_VERSION, BUILD_EXIFTOOL, memory/stack, etc.). If you change PERL_VERSION, update the hard-coded PERL5LIB paths in exiftool.go and server.go so the version segment (e.g. 5.42.0) matches the tree under embed/perl-wasi-prefix/lib/.
See LICENSE. ExifTool and embedded components carry their own licenses under embed/.