Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
createStorage
✓ import { createStorage } from 'unstorage'
✗ import createStorage from 'unstorage'
createStorage is a named export, not default
defineDriver
✓ import { defineDriver } from 'unstorage'
Used to create custom drivers
prefixStorage
✓ import { prefixStorage } from 'unstorage'
✗ import prefixStorage from 'unstorage'
Named export for prefixing storage keys
default
✓ import storage from 'unstorage'
✗ import { default as storage } from 'unstorage'
There is no default export; you must use named exports or create a storage instance.
Creates a storage instance (default in-memory), sets, gets, and deletes a JSON object.
import { createStorage } from 'unstorage';
const storage = createStorage({
driver: process.env.STORAGE_DRIVER ?? 'memory',
});
async function main() {
await storage.setItem('session:user', { name: 'Alice', role: 'admin' });
const user = await storage.getItem('session:user');
console.log(user); // { name: 'Alice', role: 'admin' }
await storage.del('session:user');
}
main().catch(console.error);
Errors
Common errors & fixes
Cannot find module 'unstorage' or its corresponding type declarations.
unstorage is not installed or missing TypeScript definitions.
fixnpm install unstorage (or yarn/pnpm add).
TypeError: createStorage is not a function
Default import instead of named import.
fixUse import { createStorage } from 'unstorage'. Error: Cannot find module 'ioredis'
Missing driver dependency for Redis.
No driver was specified. Using the default built-in memory driver.
No driver configured in createStorage options.
fixAdd a driver: createStorage({ driver: 'fs', options: { base: './data' } }). Audit
Dependencies
@azure/app-configurationoptionalOptional driver for Azure App Configuration
@azure/cosmosoptionalOptional driver for Azure Cosmos DB
@azure/data-tablesoptionalOptional driver for Azure Tables
@azure/identityoptionalOptional driver for Azure Identity
@azure/keyvault-secretsoptionalOptional driver for Azure Key Vault
@azure/storage-bloboptionalOptional driver for Azure Blob Storage
@capacitor/preferencesoptionalOptional driver for Capacitor Preferences
@deno/kvoptionalOptional driver for Deno KV
@netlify/blobsoptionalOptional driver for Netlify Blobs
@planetscale/databaseoptionalOptional driver for PlanetScale
@upstash/redisoptionalOptional driver for Upstash Redis
@vercel/bloboptionalOptional driver for Vercel Blob
@vercel/functionsoptionalOptional driver for Vercel Functions
@vercel/kvoptionalOptional driver for Vercel KV
aws4fetchoptionalOptional driver for AWS S3
db0optionalOptional driver for database (db0)
idb-keyvaloptionalOptional driver for IndexedDB
ioredisoptionalOptional driver for Redis
uploadthingoptionalOptional driver for UploadThing