@ragfoundry/adapter-loader-text
v0.1.2
Published
Text and Markdown document loader for RAGFoundry.
Maintainers
Readme
@ragfoundry/adapter-loader-text
📄 Text and Markdown loader. Load .txt, .md and .markdown files from a directory or a single file.
A DocumentLoader adapter for RAGFoundry — typed retrieval-augmented generation for TypeScript.
💡 New to RAGFoundry? This page is for adding one specific provider to an app you're already building. Starting a project from scratch is faster with the scaffolder — it asks a few questions and wires everything (including this adapter, if you pick it) for you:
npm create @ragfoundry my-app
📦 Install
npm install @ragfoundry/core @ragfoundry/adapter-loader-text🚀 Usage
Works with both import and require — this package ships both builds.
ESM:
import { createRAG } from "@ragfoundry/core"
import "@ragfoundry/adapter-loader-text"
const rag = createRAG({
loader: { provider: "text", extensions: [".md"], recursive: true },
// ...the rest of your config
})CommonJS:
const { createRAG } = require("@ragfoundry/core")
require("@ragfoundry/adapter-loader-text")
const rag = createRAG({
loader: { provider: "text", extensions: [".md"], recursive: true },
// ...the rest of your config
})⚠️ The import/require is what registers "text" at runtime — remove
it and createRAG throws Unknown adapter "text", even though the
provider name is still typed correctly. In TypeScript it's also what makes the
loader block above autocomplete and type-check.
⚙️ Options
| Option | Type | Required | Default |
|---|---|---|---|
| extensions | string[] | no | [".txt", ".md", ".markdown"] |
| recursive | boolean | no | true |
| encoding | BufferEncoding | no | utf8 |
📝 Document ids are paths relative to the source root with forward slashes, so chunk ids stay stable across machines. A file named directly is loaded whatever its extension — the filter applies to directory walks.
🔗 See also
@ragfoundry/core— the pipelines, types, and every export explained@ragfoundry/create—npm create @ragfoundry, scaffold a whole project
📄 License
MIT
