/** * Utility functions for SD metadata parsing * Common utilities used across different format parsers */ /** * Decode data URI to buffer */ export declare function decodeDataUri(value: string): Buffer | null; /** * Convert base64 string to buffer */ export declare function bufferFromBase64(value: string): Buffer | null; /** * Detect image format from buffer */ export declare function detectImageFormat(buffer: Buffer): 'png' | 'webp' | 'jpeg' | null; /** * Normalize local file path */ export declare function normalizeLocalPath(target: string): string | null; /** * Try to read local file as buffer */ export declare function tryReadLocalFileBuffer(target: string): Promise; /** * Guess file extension from various attributes */ export declare function guessFileExtension(attrs: Record, sourceHint?: string): string; /** * Check if a value is a valid URL */ export declare function isValidUrl(value: string): boolean; /** * Normalize URL for deduplication (sort query params) */ export declare function normalizeUrl(url?: string): string; /** * Create a unique key for an image segment */ export declare function makeImageSegmentKey(segment: { attrs?: Record; data?: Record; }): string; /** * Simple LRU cache implementation */ export declare class LRUCache { private cache; private readonly maxSize; constructor(maxSize?: number); get(key: K): V | undefined; set(key: K, value: V): void; has(key: K): boolean; clear(): void; get size(): number; } /** * Validation helpers */ export declare class Validation { static isString(value: any): value is string; static isNumber(value: any): value is number; static isObject(value: any): value is Record; static isBuffer(value: any): value is Buffer; static isNonEmptyString(value: any): value is string; } /** * Parse metadata value safely */ export declare function parseMetadataValue(value: any, parser: (v: any) => T | null): T | undefined; /** * Get nested object value safely */ export declare function getNestedValue(obj: any, path: string): any; export type { ImageSegment } from './types';