# GenericLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/generic/GenericLoader)

Generic Document Loader.

A generic document loader that allows combining an arbitrary blob loader with
a blob parser.

Examples:

    Parse a specific PDF file:

    .. code-block:: python

        from langchain_community.document_loaders import GenericLoader
        from langchain_community.document_loaders.parsers.pdf import PyPDFParser

        # Recursively load all text files in a directory.
        loader = GenericLoader.from_filesystem(
            "my_lovely_pdf.pdf",
            parser=PyPDFParser()
        )

   .. code-block:: python

        from langchain_community.document_loaders import GenericLoader
        from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader

        loader = GenericLoader.from_filesystem(
            path="path/to/directory",
            glob="**/[!.]*",
            suffixes=[".pdf"],
            show_progress=True,
        )

        docs = loader.lazy_load()
        next(docs)

Example instantiations to change which files are loaded:

.. code-block:: python

    # Recursively load all text files in a directory.
    loader = GenericLoader.from_filesystem("/path/to/dir", glob="**/*.txt")

    # Recursively load all non-hidden files in a directory.
    loader = GenericLoader.from_filesystem("/path/to/dir", glob="**/[!.]*")

    # Load all files in a directory without recursion.
    loader = GenericLoader.from_filesystem("/path/to/dir", glob="*")

Example instantiations to change which parser is used:

.. code-block:: python

    from langchain_community.document_loaders.parsers.pdf import PyPDFParser

    # Recursively load all text files in a directory.
    loader = GenericLoader.from_filesystem(
        "/path/to/dir",
        glob="**/*.pdf",
        parser=PyPDFParser()
    )

## Signature

```python
GenericLoader(
    self,
    blob_loader: BlobLoader,
    blob_parser: BaseBlobParser,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `blob_loader` | `BlobLoader` | Yes | A blob loader which knows how to yield blobs |
| `blob_parser` | `BaseBlobParser` | Yes | A blob parser which knows how to parse blobs into documents |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    blob_loader: BlobLoader,
    blob_parser: BaseBlobParser,
) -> None
```

| Name | Type |
|------|------|
| `blob_loader` | `BlobLoader` |
| `blob_parser` | `BaseBlobParser` |


## Properties

- `blob_loader`
- `blob_parser`

## Methods

- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/document_loaders/generic/GenericLoader/lazy_load)
- [`load_and_split()`](https://reference.langchain.com/python/langchain-community/document_loaders/generic/GenericLoader/load_and_split)
- [`from_filesystem()`](https://reference.langchain.com/python/langchain-community/document_loaders/generic/GenericLoader/from_filesystem)
- [`get_parser()`](https://reference.langchain.com/python/langchain-community/document_loaders/generic/GenericLoader/get_parser)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/d5ea8358933260ad48dd31f7f8076555c7b4885a/libs/community/langchain_community/document_loaders/generic.py#L32)