import type { DocumentLoader, DocumentSource, FileInput } from './index.js'; /** Options shared by the file loaders. */ export interface FileLoaderOptions { /** Application data added to every document. */ metadata?: Record; } /** Plain text files, one document each, whose id and source are the file's path or name. */ export declare function loadText(inputs: FileInput | Iterable, options?: FileLoaderOptions): AsyncGenerator; /** Turns one file into documents: a loader such as `loadMarkdown` or `loadHtml`, given a single input. */ export type FileParser = (input: FileInput) => DocumentLoader; /** Options for `loadDirectory()`. */ export interface DirectoryLoaderOptions extends FileLoaderOptions { /** * File extensions read, lower case with the dot. Defaults to the extensions `parsers` names, plus * `.txt` and `.md`. */ extensions?: readonly string[]; /** A parser per extension, such as `{ '.html': loadHtml }`. Other files load as plain text. */ parsers?: Record; /** Walks subdirectories. On by default. */ recursive?: boolean; /** * Skips a path, given relative to the directory with `/` separators. Defaults to skipping * `node_modules` and any directory whose name starts with a dot. */ ignore?: (path: string) => boolean; /** Stops after this many files, as a guard against pointing at the wrong directory. Defaults to 10,000. */ maxFiles?: number; } /** * Every matching file under a directory, in sorted order so a load is reproducible. Ids and sources * are paths relative to the directory, so the same tree loaded from another checkout produces the * same chunk ids. */ export declare function loadDirectory(directory: string, options?: DirectoryLoaderOptions): AsyncGenerator;