agsamantha/node_modules/@langchain/community/dist/document_loaders/fs/notion.js
2024-10-02 15:15:21 -05:00

15 lines
622 B
JavaScript

import { DirectoryLoader, UnknownHandling, } from "langchain/document_loaders/fs/directory";
import { TextLoader } from "langchain/document_loaders/fs/text";
/**
* A class that extends the DirectoryLoader class. It represents a
* document loader that loads documents from a directory in the Notion
* format. It uses the TextLoader for loading '.md' files and ignores
* unknown file types.
*/
export class NotionLoader extends DirectoryLoader {
constructor(directoryPath) {
super(directoryPath, {
".md": (filePath) => new TextLoader(filePath),
}, true, UnknownHandling.Ignore);
}
}