• Import from "@langchain/community/document_loaders/fs/obsidian" instead. This entrypoint will be removed in 0.3.0.

Represents a loader for directories containing Obsidian markdown files. This loader extends the DirectoryLoader and provides functionality to load and parse '.md' files with YAML frontmatter, Obsidian tags, and Dataview fields.

Hierarchy (view full)

Constructors

Properties

directoryPath: string
recursive: boolean = true
unknown: UnknownHandling = UnknownHandling.Warn

Methods

  • Loads the documents from the directory. If a file is a directory and recursive is true, it recursively loads documents from the subdirectory. If a file is a file, it checks if there is a corresponding loader function for the file extension in the loaders mapping. If there is, it loads the documents. If there is no corresponding loader function and unknown is set to Warn, it logs a warning message. If unknown is set to Error, it throws an error.

    Returns Promise<Document[]>

    A promise that resolves to an array of loaded documents.

  • Imports the necessary functions from the node:path and node:fs/promises modules. It is used to dynamically import the functions when needed. If the import fails, it throws an error indicating that the modules failed to load.

    Returns Promise<{
        extname: ((path: string) => string);
        readdir: {
            (path: PathLike, options?: null | ObjectEncodingOptions & {} | BufferEncoding): Promise<string[]>;
            (path: PathLike, options: {} | "buffer"): Promise<Buffer[]>;
            (path: PathLike, options?: null | BufferEncoding | ObjectEncodingOptions & {}): Promise<string[] | Buffer[]>;
            (path: PathLike, options: ObjectEncodingOptions & {}): Promise<Dirent[]>;
        };
        resolve: ((...paths: string[]) => string);
    }>

    A promise that resolves to an object containing the imported functions.

""