UNPKG

@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

125 lines (124 loc) 3.42 kB
/** * CLI Helpers for File Processors * * Provides utilities for CLI integration of the file processor system. * These helpers can be used by CLI commands to process files. * * @module processors/cli/fileProcessorCli * * @example * ```typescript * import { * loadFileFromPath, * processFileFromPath, * listSupportedFileTypes, * getCliUsage, * } from "./processors/cli/index.js"; * * // Process a file from the CLI * const result = await processFileFromPath("./document.docx", { * verbose: true, * outputFormat: "json", * }); * * if (result.success) { * console.log(result.output); * } else { * console.error(result.error); * } * ``` */ import type { FileInfo, CliFileProcessingOptions, CliProcessingResult, SupportedFileTypeInfo } from "../../types/index.js"; /** * Load a file from the filesystem and create a FileInfo object. * * @param filePath - Path to the file (relative or absolute) * @returns FileInfo object ready for processing * @throws Error if file doesn't exist or is not a file * * @example * ```typescript * const fileInfo = await loadFileFromPath("./document.pdf"); * console.log(`Loaded: ${fileInfo.name} (${fileInfo.size} bytes)`); * ``` */ export declare function loadFileFromPath(filePath: string): Promise<FileInfo>; /** * Process a file from a path using the CLI. * * @param filePath - Path to the file to process * @param options - Processing options (verbose, processor, outputFormat) * @returns Processing result with success status, output, and error info * * @example * ```typescript * const result = await processFileFromPath("./data.xlsx", { * verbose: true, * outputFormat: "json", * }); * * if (result.success) { * console.log(result.output); * } else { * console.error(`Error: ${result.error}`); * } * ``` */ export declare function processFileFromPath(filePath: string, options?: CliFileProcessingOptions): Promise<CliProcessingResult>; /** * Get information about all supported file types. * * @returns Array of supported file type information * * @example * ```typescript * const types = getSupportedFileTypes(); * for (const type of types) { * console.log(`${type.name}: ${type.extensions.join(", ")}`); * } * ``` */ export declare function getSupportedFileTypes(): Promise<SupportedFileTypeInfo[]>; /** * List all supported file types formatted for CLI display. * * @returns Formatted string listing all supported file types * * @example * ```typescript * console.log(listSupportedFileTypes()); * ``` */ export declare function listSupportedFileTypes(): Promise<string>; /** * Get CLI usage information for file processing commands. * * @returns Usage help string * * @example * ```typescript * console.log(getCliUsage()); * ``` */ export declare function getCliUsage(): string; /** * Check if a file exists and is readable. * * @param filePath - Path to check * @returns true if file exists and is readable */ export declare function fileExists(filePath: string): boolean; /** * Get file extension from a path. * * @param filePath - File path * @returns Lowercase extension with leading dot, or empty string */ export declare function getFileExtension(filePath: string): string; /** * Detect MIME type for a file path. * * @param filePath - File path * @returns Detected MIME type */ export declare function detectMimeType(filePath: string): string;