@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
71 lines (70 loc) • 2.29 kB
TypeScript
/**
* Audio file utilities for CLI
*
* Provides functionality for saving TTS audio to files with proper
* error handling and directory creation.
*
* @module cli/utils/audioFileUtils
*/
import type { TTSResult, AudioSaveResult, TTSAudioFormat } 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 formatFileSize(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 resolveOutputPath(outputPath: string): string;
/**
* Ensure parent directories exist, creating them if necessary
*
* @param filePath - Full path to the file
*/
export declare function ensureDirectoryExists(filePath: string): Promise<void>;
/**
* Get appropriate file extension for audio format
*
* @param format - Audio format
* @returns File extension (including dot)
*/
export declare function getAudioExtension(format: TTSAudioFormat): string;
/**
* Validate and normalize output path, adding extension if needed
*
* @param outputPath - User-specified output path
* @param format - Audio format for extension
* @returns Normalized output path
*/
export declare function normalizeOutputPath(outputPath: string, format?: TTSAudioFormat): string;
/**
* Save TTS audio result to a file
*
* Creates parent directories if they don't exist and handles both
* absolute and relative paths.
*
* @param audio - TTS result containing audio buffer
* @param outputPath - Path where the audio should be saved
* @returns Save result with success status, path, and size
*
* @example
* ```typescript
* const result = await saveAudioToFile(audioResult, "./output/audio.mp3");
* if (result.success) {
* console.log(`Saved to ${result.path} (${formatFileSize(result.size)})`);
* }
* ```
*/
export declare function saveAudioToFile(audio: TTSResult, outputPath: string): Promise<AudioSaveResult>;
/**
* Validate that a path is writable
*
* @param filePath - Path to validate
* @returns True if the path is writable
*/
export declare function isPathWritable(filePath: string): Promise<boolean>;