Documentation
¶
Overview ¶
Package metaextractor provides functionality for extracting comprehensive metadata from files. It combines file system information, TrID file type analysis, and EXIF data extraction.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoFileSpecified is returned when no file path is provided. ErrNoFileSpecified = errors.New("no file specified") // ErrFileNotFound is returned when the specified file cannot be located or accessed. ErrFileNotFound = errors.New("file not found") // ErrNoMetadataExtracted indicates that no metadata could be extracted from the file. ErrNoMetadataExtracted = errors.New("no metadata extracted") )
Functions ¶
This section is empty.
Types ¶
type ExifMetadata ¶
type ExifMetadata map[string]interface{}
ExifMetadata is a map of EXIF metadata extracted from a file.
type FileTime ¶
type FileTime struct {
// ModTime is the last modification time of the file.
ModTime time.Time
// AccessTime is the last access time of the file.
AccessTime time.Time
// ChangeTime is the last status change time of the file.
// This can differ from ModTime as it includes changes to permissions, ownership, etc.
ChangeTime time.Time
// BirthTime is the creation time of the file.
// Note: This may not be available on all file systems.
BirthTime time.Time
}
FileTime represents various timestamps associated with a file.
type MetaExtractor ¶
type MetaExtractor struct {
// contains filtered or unexported fields
}
MetaExtractor represents a metadata extraction instance with specific configurations.
func NewMetaExtractor ¶
func NewMetaExtractor(opts Options) *MetaExtractor
NewMetaExtractor creates a new MetaExtractor instance with the given options.
type Metadata ¶
type Metadata struct {
// Name is the base name of the file, including the extension.
Name string
// Extension is the file extension (e.g., ".txt", ".pdf").
Extension string
// ExtMismatch indicates whether the file's extension differs from its detected type.
ExtMismatch bool
// Size is the file size in bytes.
Size int64
// Time contains various timestamps associated with the file.
Time FileTime
// Types is a slice of detected file types.
// The first element (if present) is considered the most likely file type.
Types []trid.FileType
// Exif contains extracted EXIF metadata from the file.
Exif ExifMetadata
}
Metadata contains comprehensive metadata extracted from a file.
type Options ¶
type Options struct {
// TridPath is the file system path to the TrID executable.
TridPath string
// TridDefs is the file system path to the TrID definitions package.
TridDefs string
// TridTimeout is the maximum duration allowed for TrID execution.
TridTimeout time.Duration
// TridMatches specifies the maximum number of file type matches to return from TrID.
TridMatches int
// ExifToolPath is the file system path to the ExifTool executable.
ExifToolPath string
}
Options configures the metadata extraction parameters.