Registry / database / redis-level

redis-level

JSON →
library0.0.5jsnpmunverified

An abstract-level database backed by Redis for Node.js. Version 0.0.5, released as an early-stage library under the Level ecosystem. It implements the abstract-level interface, allowing Redis to be used as a LevelDB-compatible store. Key differentiators: leverages Redis for persistence and scalability, supports callbacks and async/await, and follows the Level API conventions. Suitable for projects that need a Level-like API but with Redis as the backend. Maintenance is active but the package is young; breaking changes may occur.

npm install redis-level
INSTALL
IMPORT
SIG · REDIS-LEVEL
R
redis-level
databasejavascriptv0.0.5
harness data pending
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.

RedisLevel
import { RedisLevel } from 'redis-level'
import RedisLevel from 'redis-level'
ESM import must use named export. Default export is not available.
RedisLevel (CJS)
const { RedisLevel } = require('redis-level')
const RedisLevel = require('redis-level')
CommonJS works, but must destructure the named export.
RedisLevel (type import)
import type { RedisLevel } from 'redis-level'
TypeScript users can import the type separately.

Shows basic put and get operations with async/await. Note that the `url` is taken from environment or defaults to localhost.

import { RedisLevel } from 'redis-level' const db = new RedisLevel({ redis: { url: process.env.REDIS_URL ?? 'redis://localhost:6379' } }) await db.put('key', 'value') const val = await db.get('key') console.log(val) // 'value' await db.close()
Debug
Known issues
breakingRedis client options must be nested under a `redis` property. Do not pass Redis options directly.
fix
Wrap your Redis options in `{ redis: { ... } }`.
affects: >=0.0.0
gotchaThe `redis` npm package (version 4+) is required; does not work with ioredis or older versions of node-redis.
fix
Install `npm install redis` alongside `redis-level`.
affects: >=0.0.0
deprecatedCallback support is deprecated; prefer async/await or Promises.
fix
Use async/await instead of callbacks.
affects: >=0.0.0
gotchaValues are serialized using `abstract-level`'s default codec (JSON). Binary data may not work out of the box.
fix
Configure a custom codec if you need to store Buffers or other types.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Redis connection to localhost:6379 failed
Redis server is not running or URL is incorrect.
fix
Ensure Redis is running on localhost:6379 or set REDIS_URL to a valid server.
TypeError: RedisLevel is not a constructor
Default import used instead of named import.
fix
Use `const { RedisLevel } = require('redis-level')` or `import { RedisLevel } from 'redis-level'`.
Module not found: Can't resolve 'redis'
Missing peer dependency `redis`.
fix
Run `npm install redis`.
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
redisrequiredThe underlying Redis client for all database operations
abstract-levelrequiredProvides the abstract-level base class and interface
Agent activity
16 hits · last 30 days
node
14
Resources
redis-level — npm install redis-level · libregistry