Guide
Drivers
Inject custom unstorage drivers for single-driver and multi-driver schemas — useful for testing and SSR.
Use options.driver for single-driver schemas and options.drivers for multi-driver maps.
Inject a driver (single)
single-driver.ts
import memory from 'unstorage/drivers/memory'
import { createKvModel } from 'comark-kv/model'
const handle = await createKvModel(descriptor, { driver: memory() })
Inject drivers (multi)
multi-driver.ts
import memory from 'unstorage/drivers/memory'
import { createKvModel } from 'comark-kv/model'
const handle = await createKvModel(map, {
drivers: {
local: memory(),
session: memory(),
},
})
Keys in drivers match namespace names from frontmatter. Each namespace gets the injected driver instead of the one declared in YAML.