
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
node-redis-async
Advanced tools
Plugin for the [redis](https://github.com/NodeRedis/node_redis) package. Adds a useful `.cmd()` method to the redis client.
Plugin for the redis package. Adds a useful .cmd()
method to the redis client.
npm install --save node-redis-async
# redis is required as a peer dependency
npm install --save redis
All commands are replaced by the promise-based .cmd()
method.
const redis = require('redis');
require('node-redis-async'); // Load the plugin
const client = redis.createClient(6379, 'redis');
// node-redis-async usage
client.cmd(['set', 'key', 'val'])
.then(res => console.log(res))
.catch(err => console.error(err));
// You can still use redis normally
client.set('key', 'val', (err, res) => {
if (err) {
console.error(err);
} else {
console.log(res);
}
});
Simply pass an array with multiple commands and they will be performed atomically. This removes boilerplate code by performing the necessary multi()
and exec()
calls under the hood.
client.cmd([
['get', 'key'],
['set', 'key1', '1'],
['set', 'key2', '2'],
])
.then(res => console.log(res)) // => [ 'val', 'OK', 'OK' ]
.catch(err => console.error(err));
Redis stores all values as strings. By default, the .cmd()
function casts values back to their original types.
client.cmd(['set', 'key', 2]);
client.cmd(['get', 'key'])
.then(res => console.log(res, typeof res)); // => 2 Number
client.cmd(['set', 'key', true]);
client.cmd(['get', 'key'])
.then(res => console.log(res, typeof res)); // => true Boolean
client.cmd(['set', 'key', '1a']);
client.cmd(['get', 'key'])
.then(res => console.log(res, typeof res)); // => 1a String
To disable casting, use the noCast
flag.
client.cmd(['set', 'key', true]);
client.cmd(['get', 'key'], { noCast: true })
.then(res => console.log(res, typeof res)); // => true String
Note that a best guess is made when casting. Example:
// Set a string that is a valid number => returns a number
client.cmd(['set', 'key', '22']);
client.cmd(['get', 'key'])
.then(res => console.log(res, typeof res)); // => 22 Number
// Set a string that is a valid bool => returns a bool
client.cmd(['set', 'key', 'true']);
client.cmd(['get', 'key'])
.then(res => console.log(res, typeof res)); // => true Boolean
FAQs
Plugin for the [redis](https://github.com/NodeRedis/node_redis) package. Adds a useful `.cmd()` method to the redis client.
The npm package node-redis-async receives a total of 2 weekly downloads. As such, node-redis-async popularity was classified as not popular.
We found that node-redis-async 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.