Overview
The BlobStore API provides content-addressable storage using FNV-1a 64-bit hashing. It supports both in-memory and IndexedDB-backed implementations for storing arbitrary binary data.BlobStore Interface
Defines the contract for content-addressable blob storage.Methods
get
Retrieves a blob by its content hash.The 16-character lowercase hex hash of the content
The blob data, or
null if not foundput
Stores a blob and returns its content hash.The binary data to store
The 16-character lowercase hex hash of the content
Duplicate content is automatically deduplicated by hash
delete
Removes a blob from storage.The content hash to delete
has
Checks if a blob exists in storage.The content hash to check
true if the blob exists, false otherwiseMemoryBlobStore
In-memory implementation using a Map.Constructor
Example
Data is copied on get/put to prevent callers from mutating internal state. See
BlobStore.ts:94-95IndexedDBBlobStore
Persistent browser storage using IndexedDB.Constructor
Configuration
- Database name:
lifo-blobs(seeBlobStore.ts:120) - Object store:
blobs(seeBlobStore.ts:121)
Methods
open
Opens or creates the IndexedDB database. Must be called before other methods.Example
Gracefully degrades if IndexedDB is unavailable (e.g., in private browsing mode)
Hash Function
ThehashBytes function computes a 64-bit FNV-1a hash.
The bytes to hash
A 16-character lowercase hexadecimal string representing the 64-bit hash
Example
Algorithm Details
- Algorithm: FNV-1a (Fowler-Noll-Vo)
- Output size: 64 bits
- Offset basis:
0xcbf29ce484222325 - Prime:
0x00000100000001b3
The implementation uses 32-bit arithmetic for compatibility and splits the 64-bit state into high and low words. See
BlobStore.ts:8-71Storage Comparison
| Feature | MemoryBlobStore | IndexedDBBlobStore |
|---|---|---|
| Persistence | No | Yes (browser storage) |
| Performance | Fastest | Fast (async I/O) |
| Capacity | Limited by RAM | ~50MB-unlimited* |
| Use case | Testing, temporary | Production |
Integration with VFS
BlobStore is used by the virtual filesystem for:- Large file storage: Files that exceed chunking thresholds
- Content deduplication: Identical content stored once
- Lazy loading: Content loaded on-demand from IndexedDB