@opensubtitles/video-metadata-extractor
Version:
A comprehensive NPM package for video metadata extraction and subtitle processing using FFmpeg WASM. Supports metadata extraction, individual subtitle extraction, batch subtitle extraction with ZIP downloads, and memory-safe processing of files of any siz
78 lines • 2.49 kB
TypeScript
/**
* File processing utilities with memory-safe chunked operations
* Centralizes file handling logic to eliminate duplication
*/
import { ProcessingStats } from '../types/index.js';
/**
* File processor class for handling large files with chunked processing
*/
export declare class FileProcessor {
private stats;
private debug;
constructor(debug?: boolean);
/**
* Process file in chunks with memory-safe streaming
*/
processInChunks<T>(file: File, chunkProcessor: (chunk: Blob, index: number, total: number) => Promise<T>, options?: {
chunkSize?: number;
onProgress?: (progress: number, text: string) => void;
}): Promise<T[]>;
/**
* Create complete file data using chunked streaming
* Memory-safe approach for files of any size
*/
createCompleteFileData(file: File, onProgress?: (progress: number, text: string) => void): Promise<Blob>;
/**
* Progressive extraction for very large files
*/
extractFromMultipleChunks<T>(file: File, extractor: (chunk: Blob, position: number) => Promise<T | null>, options?: {
maxChunks?: number;
chunkSize?: number;
onProgress?: (progress: number, text: string) => void;
}): Promise<T | null>;
/**
* Handle large file downloads with chunked streaming
*/
downloadLargeFile(data: Uint8Array, filename: string, onProgress?: (progress: number) => void): void;
/**
* Standard blob download for normal-sized files
*/
private _standardBlobDownload;
/**
* Chunked stream download for large files
*/
private _chunkedStreamDownload;
/**
* Get processing statistics
*/
getStats(): ProcessingStats;
/**
* Reset processor state
*/
reset(): void;
}
/**
* Utility functions for file operations
*/
/**
* Check if file is considered large
*/
export declare function isLargeFile(file: File): boolean;
/**
* Check if file is considered very large
*/
export declare function isVeryLargeFile(file: File): boolean;
/**
* Get recommended processing strategy based on file size
*/
export declare function getRecommendedProcessingStrategy(file: File): 'quick' | 'chunked' | 'progressive';
/**
* Create a file processor instance with options
*/
export declare function createFileProcessor(options?: {
debug?: boolean;
chunkSize?: number;
}): {
processCompleteFile: (file: File) => Promise<Blob>;
};
//# sourceMappingURL=fileProcessor.d.ts.map