exiftool-vendored provides two levels of configuration:
ExifTool instancesimport { ExifTool, Settings } from "exiftool-vendored";
// Use the singleton for simple cases
import { exiftool } from "exiftool-vendored";
const tags = await exiftool.read("photo.jpg");
// Or create a custom instance
const et = new ExifTool({
maxProcs: 4,
taskTimeoutMillis: 30000,
});
The Settings object provides global configuration:
import { Settings } from "exiftool-vendored";
// Enable historical timezone offsets for archival photos
Settings.allowArchaicTimezoneOffsets.value = true;
// Observe setting changes
const unsubscribe = Settings.allowArchaicTimezoneOffsets.onChange(
(oldValue, newValue) => console.log(`Changed: ${oldValue} -> ${newValue}`),
);
// Reset all settings to defaults
Settings.reset();
Available settings:
allowArchaicTimezoneOffsets - Parse historical timezone offsets (default: false)allowBakerIslandTime - Accept UTC-12:00 timezone (default: false)maxValidOffsetMinutes - Tolerance for GPS/UTC timezone inference (default: 30)logger - Logging configuration (default: enabled when NODE_DEBUG=exiftool-vendored)The ExifToolOptions interface provides detailed configuration for individual ExifTool instances.
High-throughput processing:
const exiftool = new ExifTool({
maxProcs: 8,
maxTasksPerProcess: 1000,
taskTimeoutMillis: 60000,
});
Timezone accuracy:
const exiftool = new ExifTool({
backfillTimezones: true,
inferTimezoneFromDatestamps: true,
preferTimezoneInferenceFromGps: true,
});
Using geo-tz for accurate timezone lookup:
import { find } from "geo-tz";
const exiftool = new ExifTool({
geoTz: (lat, lon) => find(lat, lon)[0],
});
Enable geolocation features:
const exiftool = new ExifTool({
geolocation: true, // Requires ExifTool 12.78+
});
const tags = await exiftool.read("photo.jpg");
console.log(tags.GeolocationCity, tags.GeolocationCountryCode);
MWG composite tags:
const exiftool = new ExifTool({
useMWG: true, // Recommended by ExifTool, enabled by default
});
Always clean up ExifTool instances to prevent hanging processes:
// Modern approach with disposables (TypeScript 5.2+)
{
await using exiftool = new ExifTool();
const tags = await exiftool.read("photo.jpg");
} // Automatic cleanup
// Traditional approach
const exiftool = new ExifTool();
try {
const tags = await exiftool.read("photo.jpg");
} finally {
await exiftool.end();
}
For complete documentation of all options with defaults: