/** * Common utility functions used across the application * Centralizes reusable functionality to eliminate duplication */ import { Result, FileValidationResult, ProcessingStats } from '../types/index.js'; /** * Async retry utility with exponential backoff */ export declare function withRetry(operation: () => Promise, maxAttempts?: number, baseDelay?: number): Promise; /** * Safe async operation wrapper that returns Result type */ export declare function safeAsync(operation: () => Promise): Promise>; /** * Sleep utility for delays */ export declare const sleep: (ms: number) => Promise; /** * Format file size in human-readable format * Eliminates duplication across multiple files */ export declare function formatFileSize(bytes: number): string; /** * Format duration from seconds to human-readable format */ export declare function formatDuration(seconds: number | string): string; /** * Get file format from filename */ export declare function getFormatFromFileName(filename: string): string; /** * Validate file extension and properties */ export declare function validateFile(file: File): FileValidationResult; /** * Generate subtitle filename with language code and metadata */ export declare function generateSubtitleFilename(movieFilename: string, language?: string, isForced?: boolean, codecName?: string): { filename: string; extension: string; }; /** * Safely decode data for preview with proper error handling */ export declare function safeDecodePreview(data: Uint8Array | string, maxLength?: number): string; /** * Create processing statistics tracker */ export declare function createProcessingStats(fileSize: number): ProcessingStats; /** * Update processing statistics */ export declare function updateProcessingStats(stats: ProcessingStats, chunksProcessed: number, memoryUsed?: number): ProcessingStats; /** * Calculate processing duration */ export declare function getProcessingDuration(stats: ProcessingStats): number; /** * Debounce function for performance optimization */ export declare function debounce any>(func: T, wait: number): (...args: Parameters) => void; /** * Throttle function for performance optimization */ export declare function throttle any>(func: T, limit: number): (...args: Parameters) => void; /** * Deep clone utility for objects */ export declare function deepClone(obj: T): T; /** * Check if running in browser environment */ export declare const isBrowser: () => boolean; /** * Check if WebAssembly is supported */ export declare const isWebAssemblySupported: () => boolean; /** * Generate unique ID for operations */ export declare function generateUniqueId(): string; //# sourceMappingURL=common.d.ts.map