File-based storage adapter for persisting embeddings to local disk.Documentation Index
Fetch the complete documentation index at: https://docs.agentfront.dev/llms.txt
Use this file to discover all available pages before exploring further.
Constructor
FileStorageConfig
| Option | Type | Default | Description |
|---|---|---|---|
cacheDir | string | './.cache/vectoriadb' | Cache directory |
namespace | string | 'default' | Namespace for isolation |
fileName | string | 'embeddings.json' | Cache file name |
Example
File Structure
Methods
All storage adapters implement theBaseStorageAdapter interface:
| Method | Description |
|---|---|
initialize() | Create cache directory |
load() | Load embeddings from file |
save(data) | Save embeddings to file |
hasValidCache(metadata) | Check if valid cache exists |
clear() | Delete cache file |
close() | Cleanup (no-op for file adapter) |
Security
The adapter includes path traversal protection:- Namespace is sanitized to prevent directory escape
- Resolved path is validated to stay within
cacheDir
Related
RedisStorageAdapter
Redis storage
MemoryStorageAdapter
Memory storage
Storage Guide
File adapter guide