Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow File Utils

From Leeroopedia
Revision as of 11:21, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Infiniflow_Ragflow_File_Utils.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Infrastructure, File_System
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete tool for resolving the project root directory and traversing file trees provided by the RAGFlow common library.

Description

The file_utils module provides get_project_base_directory to resolve the project root using RAG_PROJECT_BASE or RAG_DEPLOY_BASE environment variables, and traversal_files to recursively yield all file paths from a base directory.

Usage

Import get_project_base_directory when constructing file paths relative to the project root. Import traversal_files when scanning directory trees for document processing or configuration discovery.

Code Reference

Source Location

Signature

def get_project_base_directory(*args) -> str:
    """Resolve project root directory from environment or filesystem."""

def traversal_files(base: str):
    """Generator yielding all file paths recursively from base directory."""

Import

from common.file_utils import get_project_base_directory, traversal_files

I/O Contract

Inputs

Name Type Required Description
args str No Additional path components to join
base str Yes Root directory for file traversal

Outputs

Name Type Description
get_project_base_directory() returns str Absolute path to project root
traversal_files() returns Generator[str] File paths found recursively

Usage Examples

from common.file_utils import get_project_base_directory, traversal_files

# Get project root
root = get_project_base_directory()

# Get path to config
conf_path = get_project_base_directory("conf", "service_conf.yaml")

# Scan all files
for filepath in traversal_files("/data/documents"):
    print(filepath)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment