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-nightly'
✗ const createStorage = require('unstorage-nightly')
Module is ESM-only; named export.
defineDriver
✓ import { defineDriver } from 'unstorage-nightly'
Used for creating custom drivers.
builtinDrivers
✓ import { builtinDrivers } from 'unstorage-nightly'
Object containing all built-in driver factories.
default
✓ import unstorage from 'unstorage-nightly'
✗ import { default as unstorage } from 'unstorage-nightly'
Default export is an alias for `createStorage`.
Demonstrates creating a storage instance, setting and getting items, mounting a Redis driver with prefix, and watching for changes.
import { createStorage } from 'unstorage-nightly';
const storage = createStorage({
// use memory driver by default
});
// store and retrieve a value
await storage.setItem('test:key', { hello: 'world' });
const value = await storage.getItem('test:key');
console.log(value); // { hello: 'world' }
// use a prefix driver to mount a different driver
import redisDriver from 'unstorage-nightly/drivers/redis';
import { defineDriver } from 'unstorage-nightly';
const storageWithRedis = createStorage({
driver: redisDriver({
host: process.env.REDIS_HOST ?? 'localhost',
port: process.env.REDIS_PORT ?? 6379,
password: process.env.REDIS_PASSWORD ?? '',
}),
prefix: 'app:',
});
await storageWithRedis.setItem('user:1', { name: 'Alice', score: 100 });
// watch for changes
const unwatch = await storage.watch((event, key) => {
console.log(`Event: ${event}, Key: ${key}`);
});
// later stop watching
unwatch();
Errors
Common errors & fixes
Cannot find module 'unstorage-nightly' or its corresponding type declarations.
Package not installed or missing type definitions.
fixRun `npm install unstorage-nightly` and ensure your tsconfig includes node_modules.
Error: [unstorage] Unknown driver: 'redis'
Trying to use a built-in driver without installing the required peer dependency.
fixInstall the corresponding peer dependency, e.g., `npm install ioredis` for Redis driver.
TypeError: storage.watch is not a function
Calling watch on a driver that does not support watching (e.g., HTTP driver).
fixEnsure you are using a driver that supports watch (e.g., memory, fs, redis).
Error: Cannot read properties of undefined (reading 'getItem')
Storage instance not awaited or incorrectly imported.
fixEnsure you use `const storage = createStorage(...)` and that imports are correct: `import { createStorage } from 'unstorage-nightly'`. Upgrade
Version history
2.0.0-20260505-132234-7a0557flatest on npm
Audit
Dependencies
@azure/app-configurationoptionalOptional driver for Azure App Configuration
@azure/cosmosoptionalOptional driver for Azure Cosmos DB
@azure/data-tablesoptionalOptional driver for Azure Data Tables
@azure/identityoptionalOptional Azure authentication
@azure/keyvault-secretsoptionalOptional driver for Azure Key Vault Secrets
@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 integration with Vercel Functions
@vercel/kvoptionalOptional driver for Vercel KV
aws4fetchoptionalOptional driver for AWS
chokidaroptionalOptional file watcher for filesystem driver
db0optionalOptional database driver
idb-keyvaloptionalOptional driver for IndexedDB
ioredisoptionalOptional driver for Redis
lru-cacheoptionalOptional in-memory LRU cache driver
mongodboptionalOptional driver for MongoDB
ofetchoptionalOptional HTTP driver
uploadthingoptionalOptional driver for UploadThing