1.3.7 • Published 4 months ago
nano-db-fetch v1.3.7
📖 NANODbFetch driver
NANODbFetch is a database class built on top of NANODatabase, using IndexedDB for local caching of fetched data. It supports efficient data fetching, filtering, and storage using IndexedDB, allowing seamless offline access and synchronization with remote servers.
📌 Features
- IndexedDB-based caching
- Fetch data from a remote source or cache
- Filter-based data retrieval
- Manifest-based data storage and retrieval
- Change tracking and merging
- Storage usage calculation
🔑 Usage
import { NANODbFetch } from 'nano-db-fetch'
const fetchDb = new NANODbFetch('/', {
inherit: true,
extend: true,
globals: true,
refs: true,
root: 'http://localhost'
})
await fetchDb.load()
// Fetching Data
const index = await fetchDb.get('/index')
// Fetching All Nodes including files, dirs, and globals
const nodes = await fetchDb.findAllNodes()
// Saving Data into the indexedDB but acceptable for the db in next retrievals
const newData = { content: ['Empty content'] }
await fetchDb.set('/index', newData)
// Checking Storage Usage
const usage = await fetchDb.getUsage()