# Understanding Blob Storage Configuration and Resource Mounting in memU

> Learn how memU's blob storage configuration mounts local paths for external assets and how LocalFS handles resource mounting for consistent downstream processing. Discover efficient asset management for your AI projects.

- Repository: [NevaMind AI/memU](https://github.com/nevamind-ai/memu)
- Tags: deep-dive
- Published: 2026-02-19

---

**The blob storage configuration (`BlobConfig`) defines the local filesystem mount point for external assets, while the `LocalFS` class handles resource mounting by downloading remote URLs or copying existing local files into a canonical directory for consistent downstream processing.**

The NevaMind-AI/memU project manages multimodal conversations that frequently reference external files like images, audio, and documents. The **blob storage configuration** determines where these files are persisted, while the **resource mounting** mechanism abstracts file locations to provide stable, local references for the memory extraction pipeline.

## What is Blob Storage Configuration?

The `BlobConfig` class, defined in [[`src/memu/app/settings.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/settings.py)](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/settings.py#L141-L144), controls how and where memU stores external blobs. Currently, the configuration supports a single **provider** value of `"local"`, meaning all files are saved on the local filesystem rather than cloud storage.

The critical parameter is **`resources_dir`**, which defaults to `./data/resources`. This directory acts as the universal **mount point** for all fetched resources, ensuring that every component in the pipeline references a consistent, predictable filesystem location regardless of the asset's original source.

## How Resource Mounting Works in memU

Resource mounting is implemented in the `LocalFS` class located in [[`src/memu/blob/local_fs.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/blob/local_fs.py)](https://github.com/NevaMind-AI/memU/blob/main/src/memu/blob/local_fs.py#L10-L80). When a workflow component needs an external file, it invokes `LocalFS.fetch`, which processes the request through two distinct pathways depending on the input type.

### Mounting Remote URLs

For HTTP URLs, the `fetch` method (lines 57-80) derives a clean filename using the internal `_get_filename_from_url` helper, downloads the content using **httpx**, and writes the bytes into the configured `resources_dir`. The method returns the absolute local path and optionally extracts raw text for document-based modalities.

### Handling Local File Shortcuts

If the supplied path already exists on disk, as handled in lines 59-67, `LocalFS` copies the file into the mount directory rather than downloading. This ensures the service always works with a canonical location, isolating the downstream pipeline from the original file's transient location.

## Configuring and Using Blob Storage

### Customizing the Blob Mount Point

To change where resources are stored, instantiate `BlobConfig` with a custom `resources_dir` and pass it to `MemoryService`:

```python
from memu.app.service import MemoryService
from memu.app.settings import BlobConfig

# Configure a custom directory for all fetched resources

blob_cfg = BlobConfig(resources_dir="./my_blob_store")
service = MemoryService(blob_config=blob_cfg)

# All subsequent fetches will store files under ./my_blob_store

```

*Reference:* [`src/memu/app/settings.py#L141-L144`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/settings.py#L141-L144)

### Fetching a Remote Image

Inside a workflow step, such as a multimodal memory extractor, fetch external media using the service's filesystem helper:

```python

# Inside a workflow step

url = "https://example.com/photo.jpg"
local_path, _ = self.fs.fetch(url, modality="image")

# local_path → "./data/resources/photo.jpg"

```

*Reference:* [`src/memu/app/service.py#L70-L71`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/service.py#L70-L71) and [`src/memu/blob/local_fs.py#L57-L80`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/blob/local_fs.py#L57-L80)

### Handling Local File Shortcuts

When the caller already possesses a local file, `LocalFS` mounts it by copying into the resources directory:

```python

# Mounting an existing local file

local_file = "/tmp/report.txt"
mounted_path, text = self.fs.fetch(local_file, modality="document")

# mounted_path points to the copy in resources_dir

# text contains the file contents for document processing

```

*Reference:* [`src/memu/blob/local_fs.py#L59-L67`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/blob/local_fs.py#L59-L67)

## Benefits of the Blob Mount Architecture

- **Isolation** – All external blobs live under a single, configurable directory, simplifying cleanup, backup, and persistence strategies.
- **Deterministic IDs** – By normalizing filenames (removing query strings and inferring extensions from modality), the service avoids duplicate downloads and maintains predictable naming schemes.
- **Flexibility** – Changing `resources_dir` or extending `BlobConfig` with cloud providers (S3, Azure) allows deployments to control storage backends without modifying core pipeline logic.

## Summary

- The **`BlobConfig`** class in [`src/memu/app/settings.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/app/settings.py) defines the mount directory (`resources_dir`) and storage provider for external files.
- **`LocalFS.fetch`** in [`src/memu/blob/local_fs.py`](https://github.com/NevaMind-AI/memU/blob/main/src/memu/blob/local_fs.py) implements resource mounting by either downloading remote URLs via httpx or copying local files into the canonical directory.
- All mounted resources are isolated under a single path, ensuring downstream components (vectorization, OCR, transcription) receive stable filesystem references.
- The architecture supports future cloud storage extensions while currently defaulting to local filesystem storage at `./data/resources`.

## Frequently Asked Questions

### What is the default mount directory for blob storage in memU?

By default, memU stores all mounted resources in `./data/resources` relative to the execution context. This path is configurable via the `resources_dir` parameter in `BlobConfig`.

### How does memU handle filename conflicts when mounting resources?

The `LocalFS` class uses the `_get_filename_from_url` helper to derive clean filenames by stripping query parameters and inferring extensions from the specified modality. This normalization ensures deterministic IDs and prevents duplicate downloads of identical assets.

### Can I use cloud storage providers like S3 with BlobConfig?

Currently, `BlobConfig` only supports the `"local"` provider. However, the abstraction is designed to accommodate future extensions; implementing cloud providers would require extending the configuration schema and creating corresponding storage backends without touching the core `LocalFS` interface.

### What happens if a local file is passed to LocalFS.fetch?

When `fetch` receives an existing filesystem path, it copies the file into the configured `resources_dir` mount point rather than downloading. This guarantees that downstream processing always references the canonical location, isolating the pipeline from the original file's potentially transient path.