UNPKG

enterprise-basics

Version:

A utility library for enterprise applications. It streamlines common business tasks by providing functions to process delimited and Excel files, generate professional PDFs, and handle email communications with attachments.

30 lines (29 loc) 1.01 kB
import { z } from 'zod'; declare const validationSchema: z.ZodObject<{ fullPath: z.ZodEffects<z.ZodString, string, string>; }, "strip", z.ZodTypeAny, { fullPath: string; }, { fullPath: string; }>; type PdfParams = z.infer<typeof validationSchema>; /** * Parses a PDF file using LangChain's PDFLoader and returns its text content. * * @param {string} fullPath - The complete file path to the PDF file. * @returns {Promise<Document<Record<string, any>>[]>} A promise that resolves with the extracted text content of the PDF. * @throws {Error} * - If validation fails (path not provided, not a PDF). * - If the file doesn't exist. * - If LangChain fails to load or parse the PDF. * * @example * try { * const pdfText = await parsePDF('path/to/your/document.pdf'); * console.log('PDF Content:', pdfText); * } catch (error) { * console.error('Failed to parse PDF:', error.message); * } */ export declare function parsePDF(fullPath: PdfParams['fullPath']): Promise<any>; export {};