@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
99 lines (98 loc) • 3.61 kB
TypeScript
/**
* Video file utilities for CLI
*
* Provides functionality for saving generated video to files with proper
* error handling and directory creation. Follows the pattern established
* by audioFileUtils.ts for TTS output handling.
*
* @module cli/utils/videoFileUtils
*/
import type { VideoGenerationResult, VideoSaveResult } from "../../lib/types/index.js";
/**
* Format file size in human-readable format
*
* @param bytes - Size in bytes
* @returns Formatted string (e.g., "32 KB", "1.5 MB")
*/
export declare function formatVideoFileSize(bytes: number): string;
/**
* Resolve the output path, handling both absolute and relative paths
*
* @param outputPath - User-specified output path
* @returns Resolved absolute path
*/
export declare function resolveVideoOutputPath(outputPath: string): string;
/**
* Ensure parent directories exist, creating them if necessary
*
* @param filePath - Full path to the file
*/
export declare function ensureVideoDirectoryExists(filePath: string): Promise<void>;
/**
* Get appropriate file extension for video media type
*
* @param mediaType - Video media type
* @returns File extension (including dot)
*/
export declare function getVideoExtension(mediaType: "video/mp4" | "video/webm"): string;
/**
* Validate and normalize output path, adding extension if needed
*
* If the specified path has no extension or an invalid extension, the appropriate
* extension (.mp4 or .webm) will be added based on the mediaType.
* If the extension doesn't match the mediaType (e.g., .webm specified but mediaType
* is video/mp4), the extension will be replaced to match the actual format.
*
* @param outputPath - User-specified output path
* @param mediaType - Video media type for extension
* @returns Normalized output path with correct extension
*/
export declare function normalizeVideoOutputPath(outputPath: string, mediaType?: "video/mp4" | "video/webm"): string;
/**
* Format video duration in human-readable format
*
* @param seconds - Duration in seconds
* @returns Formatted string (e.g., "4s", "1m 30s")
*/
export declare function formatVideoDuration(seconds: number): string;
/**
* Format video dimensions in human-readable format
*
* @param width - Video width in pixels
* @param height - Video height in pixels
* @returns Formatted string (e.g., "1920x1080")
*/
export declare function formatVideoDimensions(width: number, height: number): string;
/**
* Save generated video result to a file
*
* Creates parent directories if they don't exist and handles both
* absolute and relative paths.
*
* @param video - Video generation result containing video buffer
* @param outputPath - Path where the video should be saved
* @returns Save result with success status, path, and size
*
* @example
* ```typescript
* const result = await saveVideoToFile(videoResult, "./output/video.mp4");
* if (result.success) {
* console.log(`Saved to ${result.path} (${formatVideoFileSize(result.size)})`);
* }
* ```
*/
export declare function saveVideoToFile(video: VideoGenerationResult, outputPath: string): Promise<VideoSaveResult>;
/**
* Type guard to check if an object is a valid VideoGenerationResult
*
* @param obj - Object to check
* @returns True if object is a valid VideoGenerationResult
*/
export declare function isVideoGenerationResult(obj: unknown): obj is VideoGenerationResult;
/**
* Get video metadata summary for display
*
* @param video - Video generation result
* @returns Formatted metadata summary string
*/
export declare function getVideoMetadataSummary(video: VideoGenerationResult): string;