> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-devupd-1765394015-eccef47.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TextLoader

<Tip>
  **Compatibility**: Only available on Node.js.
</Tip>

This notebook provides a quick overview for getting started with `TextLoader` [document loaders](/oss/javascript/integrations/document_loaders). For detailed documentation of all `TextLoader` features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html).

## Overview

### Integration details

| Class                                                                                                 | Package                                                                                   | Compatibility | Local | PY support |
| :---------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------- | :-----------: | :---: | :--------: |
| [TextLoader](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html) | [langchain](https://api.js.langchain.com/modules/langchain.document_loaders_fs_text.html) |   Node-only   |   ✅   |      ❌     |

## Setup

To access `TextLoader` document loader you'll need to install the `langchain` package.

### Installation

The LangChain TextLoader integration lives in the `langchain` package:

<CodeGroup>
  ```bash npm theme={null}
  npm install langchain
  ```

  ```bash yarn theme={null}
  yarn add langchain
  ```

  ```bash pnpm theme={null}
  pnpm add langchain
  ```
</CodeGroup>

## Instantiation

Now we can instantiate our model object and load documents:

```typescript theme={null}
import { TextLoader } from "@langchain/classic/document_loaders/fs/text"

const loader = new TextLoader("../../../../../../examples/src/document_loaders/example_data/example.txt")
```

## Load

```typescript theme={null}
const docs = await loader.load()
docs[0]
```

```output theme={null}
Document {
  pageContent: 'Foo\nBar\nBaz\n\n',
  metadata: {
    source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
  },
  id: undefined
}
```

```typescript theme={null}
console.log(docs[0].metadata)
```

```output theme={null}
{
  source: '../../../../../../examples/src/document_loaders/example_data/example.txt'
}
```

***

## API reference

For detailed documentation of all TextLoader features and configurations head to the [API reference](https://api.js.langchain.com/classes/langchain.document_loaders_fs_text.TextLoader.html).

***

<Callout icon="pen-to-square" iconType="regular">
  [Edit the source of this page on GitHub.](https://github.com/langchain-ai/docs/edit/main/src/oss/javascript/integrations/document_loaders/file_loaders/text.mdx)
</Callout>

<Tip icon="terminal" iconType="regular">
  [Connect these docs programmatically](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
</Tip>
