lollms-webui/endpoints/docs/lollms_anything_to_markdown/DOC.md
2024-08-19 23:12:58 +02:00

1.2 KiB

LoLLMs Anything to Markdown Library

Overview

JavaScript library to convert various file types to Markdown.

Key Features

  • Supports: txt, docx, pdf, pptx, and more
  • Asynchronous processing
  • Object-oriented design

Import

<script src="/lollms_assets/js/lollms_anything_to_markdown"></script>

Core Class: LollmsFileLoader

Methods

  • loadFile(file): Main method to process files
  • readTextFile(file), readDocxFile(file), readPdfFile(file), readPptxFile(file): Type-specific readers
  • convertToMarkdown(content, fileExtension): Converts content to Markdown

Usage

const lollmsFileLoader = new LollmsFileLoader();
const markdown = await lollmsFileLoader.loadFile(file);

Extensibility

  • Add new file types by creating reader methods
  • Enhance Markdown conversion logic
  • Implement caching or post-processing

Error Handling

Uses Promise-based approach. Wrap loadFile in try-catch.

Dependencies

Requires external libraries for DOCX, PDF, and PPTX processing.

This concise documentation provides the essential information for an LLM-based developer to understand and work with the library, while saving context tokens.