New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

redis-level

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-level

Redis backed abstract-level database for Node.js

latest
Source
npmnpm
Version
0.0.5
Version published
Weekly downloads
6
100%
Maintainers
0
Weekly downloads
 
Created
Source

redis-level

An abstract-level database backed by Redis.

:pushpin: What is abstract-level? Head over to the FAQ.

level badge npm Node version Biome

Usage

const { RedisLevel } = require('redis-level')

// Create a database
const db = new RedisLevel({
  redis: {
    url: "redis://localhost:6379"
  }
})

// Add an entry with key 'a' and value 1
await db.put('a', 1)

// Add multiple entries
await db.batch([{ type: 'put', key: 'b', value: 2 }])

// Get value of key 'a': 1
const value = await db.get('a')

// Iterate entries with keys that are greater than 'a'
for await (const [key, value] of db.iterator({ gt: 'a' })) {
  console.log(value) // 2
}

All asynchronous methods also support callbacks.

Callback example
db.put('example', { hello: 'world' }, (err) => {
  if (err) throw err

  db.get('example', (err, value) => {
    if (err) throw err
    console.log(value) // { hello: 'world' }
  })
})

Keywords

level

FAQs

Package last updated on 04 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts