---
title: '📁 Directory/Folder'
---

To use an entire directory as data source, just use `LocalPathLoader` and pass in the path of the local directory.
This loader automatically reads all the files in the directory and its subdirectories. If you pass the path to a single file, only that file will be read.

## Usage

```ts
import { RAGApplicationBuilder, LocalPathLoader } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';

const app = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();

app.addLoader(new LocalPathLoader({ path: '...' }))
```

<Note>
You need to have installed the neccessaty loaders to process the expected file types in the directory for the application to be able to process that file type.
</Note>
