Help us shape the future of Go! Take the 2026 Go Developer Survey

exiftool

package module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 9 Imported by: 0

README

A thin wrapper around ExifTool

PkgGoDev

Fork of ncruces/go-exiftool adding channeled output with custom splitters (NewServerCh, CommandCh).

This uses the excellent ExifTool by Phil Harvey:

dist_unix.sh and dist_windows.sh build minimal, self-contained distros of ExifTool for both Unix (Linux/macOS/etc) and Windows. Use Git BASH to run the Windows script.

The Windows version uses Strawberry Perl:

Documentation

Overview

Package exiftool provides a thin wrapper around ExifTool.

Index

Constants

This section is empty.

Variables

View Source
var (
	Exec   string = "exiftool" // Application to execute.
	Arg1   string              // Optional first argument.
	Config string              // ExifTool config file to use.
)

Configure ExifTool.

Functions

func Command

func Command(stdin io.Reader, arg ...string) (stdout []byte, err error)

Command runs an ExifTool command with the given arguments and stdin and returns its stdout.

func CommandContext

func CommandContext(ctx context.Context, stdin io.Reader, arg ...string) (stdout []byte, err error)

CommandContext is like Command but includes a context.

func DefaultSplitter

func DefaultSplitter(data []byte, atEOF bool) (advance int, token []byte, err error)

func Unmarshal

func Unmarshal(data []byte, m map[string][]byte) error

Unmarshal parses the standard, short or veryShort ExifTool output formats. Loads tag names and values into a map.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wraps an instance of ExifTool that can process multiple commands sequentially. Servers avoid the overhead of loading ExifTool for each command. Servers are safe for concurrent use by multiple goroutines.

func NewServer

func NewServer(commonArg ...string) (*Server, error)

NewServer loads a new instance of ExifTool.

func NewServerCh

func NewServerCh(chout chan<- string, splitFunc bufio.SplitFunc, commonArg ...string) (*Server, error)

NewServerCh loads a new instance of ExifTool with output to channel file by file.

func (*Server) Close

func (e *Server) Close() error

Close causes ExifTool to exit immediately. Close does not wait until ExifTool has actually exited.

func (*Server) Command

func (e *Server) Command(arg ...string) ([]byte, error)

Command runs an ExifTool command with the given arguments and returns its stdout. Commands should neither read from stdin, nor write binary data to stdout.

func (*Server) CommandCh

func (e *Server) CommandCh(arg ...string) error

Command runs an ExifTool command with the given arguments and put its stdout to channel. Commands should neither read from stdin, nor write binary data to stdout.

func (*Server) Shutdown

func (e *Server) Shutdown() error

Shutdown gracefully shuts down ExifTool without interrupting any commands, and waits for it to complete.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL