Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
redis-async-gen
Advanced tools
A little library to make scanning for a set of keys in a Redis database a little bit more tolerable.
A little library to make scanning for a set of keys in a Redis database a little bit more tolerable.
Scanning a Redis database for a key matching a pattern is not necessarily hard, but if you use the standard Redis NPM library, then there's still quite some stuff that you need to carefully handle yourself.
This project figures all of that can be simplified by introducing a generator for scanning keys, allowing the blissfully ignorant JavaScript programmer to simply use a for
comprehension:
const redis = require('redis')
const client = redis.createClient(…)
const generators = require('redis-async-gen')
const { keysMatching } = generators.using(client)
…
for await (const key of keysMatching('test*')) {
console.info(key)
}
Under the hoods, this library will execute the scan command repeatedly, fetching new sets of keys whenever it needs. The underlying cursor logic is completely hidden.
If you are using the for
comprehension to loop over keys matching a certain pattern, then be advised that you can break out of the loop at any time using the break
operation.
The library also has support for scanning values from a Set. The following will retrieve all values from a Set defined at key aaa
, starting with the prefix test
.
const redis = require('redis')
const client = redis.createClient(…)
const generators = require('redis-async-gen')
const { keysMatching } = generators.using(client)
…
for await (const key of valuesMatching('aaa', 'test*')) {
console.info(key)
}
FAQs
A little library to make scanning for a set of keys in a Redis database a little bit more tolerable.
The npm package redis-async-gen receives a total of 341 weekly downloads. As such, redis-async-gen popularity was classified as not popular.
We found that redis-async-gen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.