langchain_community.document_loaders.blob_loaders.file_system.FileSystemBlobLoader

class langchain_community.document_loaders.blob_loaders.file_system.FileSystemBlobLoader(path: Union[str, Path], *, glob: str = '**/[!.]*', exclude: Sequence[str] = (), suffixes: Optional[Sequence[str]] = None, show_progress: bool = False)[source]

Load blobs in the local file system.

Example:

from langchain_community.document_loaders.blob_loaders import FileSystemBlobLoader
loader = FileSystemBlobLoader("/path/to/directory")
for blob in loader.yield_blobs():
    print(blob)  # noqa: T201

Initialize with a path to directory and how to glob over it.

Parameters
  • path (Union[str, Path]) – Path to directory to load from or path to file to load. If a path to a file is provided, glob/exclude/suffixes are ignored.

  • glob (str) – Glob pattern relative to the specified path by default set to pick up all non-hidden files

  • exclude (Sequence[str]) – patterns to exclude from results, use glob syntax

  • suffixes (Optional[Sequence[str]]) – Provide to keep only files with these suffixes Useful when wanting to keep files with different suffixes Suffixes must include the dot, e.g. “.txt”

  • show_progress (bool) – If true, will show a progress bar as the files are loaded. This forces an iteration through all matching files to count them prior to loading them.

Examples

Methods

__init__(path, *[, glob, exclude, suffixes, ...])

Initialize with a path to directory and how to glob over it.

count_matching_files()

Count files that match the pattern without loading them.

yield_blobs()

Yield blobs that match the requested pattern.

__init__(path: Union[str, Path], *, glob: str = '**/[!.]*', exclude: Sequence[str] = (), suffixes: Optional[Sequence[str]] = None, show_progress: bool = False) None[source]

Initialize with a path to directory and how to glob over it.

Parameters
  • path (Union[str, Path]) – Path to directory to load from or path to file to load. If a path to a file is provided, glob/exclude/suffixes are ignored.

  • glob (str) – Glob pattern relative to the specified path by default set to pick up all non-hidden files

  • exclude (Sequence[str]) – patterns to exclude from results, use glob syntax

  • suffixes (Optional[Sequence[str]]) – Provide to keep only files with these suffixes Useful when wanting to keep files with different suffixes Suffixes must include the dot, e.g. “.txt”

  • show_progress (bool) – If true, will show a progress bar as the files are loaded. This forces an iteration through all matching files to count them prior to loading them.

Return type

None

Examples

count_matching_files() int[source]

Count files that match the pattern without loading them.

Return type

int

yield_blobs() Iterable[Blob][source]

Yield blobs that match the requested pattern.

Return type

Iterable[Blob]