import { ChildProcessWithoutNullStreams } from 'node:child_process'; import { Log } from '@spinajs/log-common'; import { FileInfoService, IFileInfo } from './interfaces.js'; import { DateTime } from 'luxon'; /** * A single extracted metadata value. */ type ExifValue = string | number | DateTime; /** * Resolves the path to the exiftool binary. * * Prefers the vendored binary shipped with the `exiftool-vendored` platform * packages ( no system installation required ), and falls back to `exiftool` * available on PATH. */ export declare function resolveExifToolPath(): Promise; /** * Default {@link FileInfoService} implementation backed by the `exiftool` * command line tool. * * The binary is auto-resolved ( vendored, then PATH ) unless overridden with * the `fs.fileInfo.exifToolPath` configuration key. The invocation is bounded * by the `fs.fileInfo.timeout` configuration ( default {@link DEFAULT_TIMEOUT} ). */ export declare class DefaultFileInfo extends FileInfoService { protected Log: Log; /** * Optional exiftool binary path override from configuration. When unset, the * binary is auto-resolved via {@link resolveExifToolPath}. */ protected ConfiguredPath?: string; /** * Timeout ( ms ) for the exiftool process, from configuration. */ protected Timeout: number; /** * exiftool arguments controlling extraction breadth, from configuration * ( default {@link DEFAULT_ARGS} ). The file spec ( path or `-` ) is appended * automatically. NOTE: some flags ( eg. `-G` ) change the output tag names. */ protected ExifArgs: string[]; /** * Auto-resolved exiftool binary path, cached after first use. */ protected ExifToolPath: string; /** * Extracts file information from a file on disk. * * @param pathToFile absolute path to the file * @throws {IOFail} when the file does not exist or exiftool fails */ getInfo(pathToFile: string): Promise; /** * Extracts file information from a readable stream by piping its content to * exiftool via stdin ( `exiftool -n -` ). * * @param stream readable stream with the file content * @throws {IOFail} when exiftool fails or the stream errors */ getInfoFromStream(stream: NodeJS.ReadableStream): Promise; /** * Resolves the exiftool binary path, preferring the configured override. */ protected binaryPath(): Promise; /** * Spawns the exiftool process. Extracted so it can be overridden ( eg. in tests ). */ protected spawnExif(binary: string, args: string[]): ChildProcessWithoutNullStreams; /** * Runs exiftool against a file spec ( a path, or `-` for stdin ) and returns * its stdout. * * Success/failure is determined by the process exit code ( not by the mere * presence of stderr, which exiftool uses for non-fatal warnings ). The call * is bounded by {@link Timeout} and any failure is surfaced as {@link IOFail}. * * @param fileArg file path or `-` to read from stdin * @param input optional readable stream piped to the process stdin */ protected runExifTool(fileArg: string, input?: NodeJS.ReadableStream): Promise; /** * Parses raw exiftool text output into a `{ normalisedTag: value }` map with * EVERY emitted tag ( nothing is filtered ). * * Each line is split on the FIRST `': '` only, so values that themselves * contain `': '` are preserved. Values are coerced by {@link coerceValue} * ( numbers and date-shaped strings ). */ protected parseMetadata(raw: string): Record; /** * Projects a parsed metadata map onto {@link IFileInfo}. * * Every extracted tag is promoted: known tags via their {@link TAG_ALIASES} * friendly field name, all others under their PascalCased tag name. The full * unmodified map is always available under `Raw`. */ protected toFileInfo(metadata: Record): IFileInfo; } export {}; //# sourceMappingURL=file-info.d.ts.map