Product
Introducing Java Support in Socket
We're excited to announce that Socket now supports the Java programming language.
redis-commands
Advanced tools
The redis-commands npm package provides a comprehensive list of Redis commands, including their names, arity, flags, and other metadata. It is useful for developers who need to interact with Redis and want to programmatically access command information.
Get All Commands
This feature allows you to retrieve a list of all Redis commands. The `commands.list` property contains an array of all command names.
const commands = require('redis-commands');
console.log(commands.list);
Get Command Details
This feature allows you to get detailed information about a specific Redis command. The `commands.get('set')` method returns an object with details such as arity, flags, and other metadata for the 'set' command.
const commands = require('redis-commands');
console.log(commands.get('set'));
Check Command Existence
This feature allows you to check if a specific Redis command exists. The `commands.exists('get')` method returns true if the command exists and false otherwise.
const commands = require('redis-commands');
console.log(commands.exists('get'));
console.log(commands.exists('nonexistent'));
Get Command Flags
This feature allows you to retrieve the flags associated with a specific Redis command. The `commands.get('set').flags` property returns an array of flags for the 'set' command.
const commands = require('redis-commands');
console.log(commands.get('set').flags);
ioredis is a robust, full-featured Redis client for Node.js. It supports all Redis commands and provides high availability via Redis Sentinel and Cluster. Unlike redis-commands, ioredis is focused on providing a client for interacting with Redis rather than just listing commands.
The redis package is another popular Redis client for Node.js. It supports all Redis commands and provides features like connection pooling and automatic reconnection. Similar to ioredis, it is designed for interacting with Redis servers rather than just listing commands.
node-redis is a high-performance Redis client for Node.js. It supports all Redis commands and offers features like pipelining and offline queueing. Like ioredis and redis, it is intended for interacting with Redis servers rather than just listing commands.
This module exports all the commands that Redis supports.
$ npm install redis-commands
var commands = require('redis-commands');
.list
is an array contains all the lowercased commands:
commands.list.forEach(function (command) {
console.log(command);
});
.exists()
is used to check if the command exists:
commands.exists('set') // true
commands.exists('other-command') // false
.hasFlag()
is used to check if the command has the flag:
commands.hasFlag('set', 'readonly') // false
.getKeyIndexes()
is used to get the indexes of keys in the command arguments:
commands.getKeyIndexes('set', ['key', 'value']) // [0]
commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]
Thank @Yuan Chuan for the package name. The original redis-commands is renamed to @yuanchuan/redis-commands.
v.1.7.0 - 6 Feb, 2021
Features
FAQs
Redis commands
The npm package redis-commands receives a total of 2,796,499 weekly downloads. As such, redis-commands popularity was classified as popular.
We found that redis-commands demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.
Security News
Deno 2.0 is now available with enhanced package management, full Node.js and npm compatibility, improved performance, and support for major JavaScript frameworks.