UNPKG

@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

43 lines 1.18 kB
/** * Improved type definitions with discriminated unions and strong typing */ /** * Error types for better error handling */ export class FFmpegError extends Error { constructor(message, operation, code) { super(message); this.operation = operation; this.code = code; this.name = 'FFmpegError'; } } export class FileProcessingError extends Error { constructor(message, filename, fileSize) { super(message); this.filename = filename; this.fileSize = fileSize; this.name = 'FileProcessingError'; } } export class SubtitleExtractionError extends Error { constructor(message, streamIndex, format) { super(message); this.streamIndex = streamIndex; this.format = format; this.name = 'SubtitleExtractionError'; } } /** * Type guards for stream types */ export const isVideoStream = (stream) => { return stream.codec_type === 'video'; }; export const isAudioStream = (stream) => { return stream.codec_type === 'audio'; }; export const isSubtitleStream = (stream) => { return stream.codec_type === 'subtitle'; }; //# sourceMappingURL=index.js.map