@woss/exiftool - v0.7.3
    Preparing search index...

    Class ExifTool

    Node.js entry point for exiftool-ts. Extends ExifToolCore with filesystem-based read/write operations.

    This is the main class for Node.js environments. For browser/edge, use ExifToolCore directly with Uint8Array buffers.

    import { ExifTool } from 'exiftool-ts';

    const exiftool = new ExifTool();
    const result = await exiftool.read('photo.jpg');
    console.log(result.tags.Make, result.tags.Model);

    await exiftool.write('input.jpg', 'output.jpg', {
    Title: 'My Photo',
    Artist: 'John Doe',
    });

    Hierarchy (View Summary)

    Index
    tagDb: TagDb

    Tag database for custom tag definitions.

    Resolved options (merged with defaults).

    • Parses metadata from an in-memory buffer.

      File-system-derived tags (FileName, FileSize, FileModifyDate, etc.) are absent — only embedded metadata is returned.

      Parameters

      • bytes: Uint8Array

        Image file data as Uint8Array

      Returns Promise<FileInfo>

      Parsed file information with tags

    • Writes metadata tags to an in-memory buffer.

      Returns the new bytes with updated metadata container (JPEG APP1, PNG eXIf, WebP EXIF, AVIF/HEIF meta box).

      Parameters

      • bytes: Uint8Array

        Original image data

      • tags: Record<string, TagValue>

        Tags to write (normalized format)

      Returns Promise<WriteOutcome>

      Write outcome with new bytes and any warnings

      UnsupportedFormatError if format doesn't support writing

    • Reads metadata from a file path.

      Parameters

      • filePath: string

        Path to the image file

      • Optionalhints: ParseHints

        Optional parsing hints for format-specific behavior

      Returns Promise<FileInfo>

      Parsed file information with tags grouped by metadata standard

    • Writes metadata tags to a file.

      Creates a backup file (<file>_original) unless overwriteOriginal is set. Supports JPEG (APP1), PNG (eXIf), WebP (EXIF), AVIF/HEIF (meta box).

      Parameters

      • filePath: string

        Path to the input file

      • tags: Record<string, TagValue>

        Tags to write (normalized format, see TagValue)

      • opts: WriteOptions = {}

        Write options

        Options for write operations.

        • OptionaloverwriteOriginal?: boolean

          Overwrite original file without backup (default: false)

        • OptionaloverwriteOriginalInPlace?: boolean

          Overwrite without a backup by updating the original inode instead of renaming a temp file.

        • OptionalpreserveTime?: boolean

          Preserve file modification time (default: false)

        • Optionalcompress?: boolean

          Compress supported metadata text chunks when this reduces their size.

        • OptionalwriteMode?: string

          ExifTool write-mode letters: w (overwrite), c (create), g (create groups).

      Returns Promise<WriteResult>

      Write result with success status and any warnings

    • Writes an .xmp sidecar next to a media file (Lightroom reads these for RAW/DNG pickup).

      The sidecar is an XMP packet carrying the requested XMP properties: 'XMP-dc:Subject' keys or bare aliases (Subject, Keywords, Title, Description, Rights, …). An existing sidecar is read and merged — unknown properties already in it are preserved, matching properties are replaced (idempotent re-runs produce byte-identical files). MetadataDate is written only if requested: derive it from the file's indexed mtime for byte-stable repeat runs.

      Parameters

      • mediaPath: string

        Path to the media file (sidecar path is derived)

      • tags: Record<string, TagValue>

        XMP tags to write (non-XMP keys are ignored)

      • opts: { sidecarPath?: string } = {}
        • OptionalsidecarPath?: string

          Override the sidecar path (default <media>.xmp)

      Returns Promise<{ sidecarPath: string; written: string[] }>

      The sidecar path and the tags actually written

    • Runs CLI-style arguments programmatically.

      Parameters

      • args: string[]

        Command-line arguments (e.g., ['-j', 'photo.jpg'])

      Returns Promise<number>

      Exit code (0 = success)