/** * Document Readers - Parse various document formats * * Provides readers for text, markdown, PDF, HTML, and code files. * Uses lazy loading for heavy parsers (PDF). * * @example * ```typescript * import { TextReader, MarkdownReader, createReader } from 'praisonai'; * * const reader = createReader('markdown'); * const content = await reader.read('docs/guide.md'); * ``` */ /** * Parsed document result */ export interface ParsedDocument { /** Document ID */ id: string; /** Document title/name */ title: string; /** Plain text content */ content: string; /** Original format */ format: string; /** Document metadata */ metadata: { source: string; size: number; pageCount?: number; wordCount: number; charCount: number; headers?: string[]; links?: string[]; }; /** Sections/chunks */ sections?: Array<{ title?: string; content: string; level?: number; }>; } /** * Reader interface */ export interface Reader { /** Supported file extensions */ extensions: string[]; /** Read from file path */ read(path: string): Promise; /** Parse content directly */ parse(content: string, source?: string): ParsedDocument; } /** * TextReader - Plain text files */ export declare class TextReader implements Reader { extensions: string[]; read(path: string): Promise; parse(content: string, source?: string): ParsedDocument; } /** * MarkdownReader - Markdown files */ export declare class MarkdownReader implements Reader { extensions: string[]; read(path: string): Promise; parse(content: string, source?: string): ParsedDocument; private extractTitle; private extractHeaders; private extractLinks; private extractSections; private stripMarkdown; } /** * HTMLReader - HTML files */ export declare class HTMLReader implements Reader { extensions: string[]; read(path: string): Promise; parse(content: string, source?: string): ParsedDocument; private extractTitle; private extractLinks; private stripHTML; } /** * CodeReader - Source code files */ export declare class CodeReader implements Reader { extensions: string[]; read(path: string): Promise; parse(content: string, source?: string): ParsedDocument; private detectLanguage; private extractFunctions; } /** * PDFReader - PDF files (lazy loads pdf-parse) */ export declare class PDFReader implements Reader { extensions: string[]; private pdfParse; read(path: string): Promise; parse(content: string, source?: string): ParsedDocument; parseBuffer(buffer: Buffer, source?: string): Promise; } /** * Create a reader by type */ export declare function createReader(type: 'text' | 'markdown' | 'html' | 'code' | 'pdf'): Reader; /** * Get reader for file path */ export declare function getReaderForPath(path: string): Reader; /** * Read any supported file */ export declare function readDocument(path: string): Promise; declare const _default: { TextReader: typeof TextReader; MarkdownReader: typeof MarkdownReader; HTMLReader: typeof HTMLReader; CodeReader: typeof CodeReader; PDFReader: typeof PDFReader; createReader: typeof createReader; getReaderForPath: typeof getReaderForPath; readDocument: typeof readDocument; }; export default _default;