Registry / database / redis-info

redis-info

JSON →
library0.0.0jsnpmunverified

redis-info is a focused JavaScript utility designed to accurately parse the raw string output of the Redis `INFO` command into a structured JavaScript object. This library provides a programmatic way to access detailed Redis server statistics, configuration parameters, and operational metrics. The current stable version, 3.1.0, was published approximately 4-5 years ago, indicating a maintenance-oriented release cadence primarily driven by critical bug fixes or significant changes to the Redis `INFO` command's format itself. Its primary differentiation lies in its single-purpose design, offering a direct and unopinionated conversion of the `INFO` string without coupling to a full Redis client library.

npm install redis-info
INSTALL
IMPORT
SIG · REDIS-INFO
R
redis-info
databasejavascriptv0.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
const { parse } = require('redis-info');
import { parse } from 'redis-info';
This package primarily supports CommonJS `require` syntax. Native ES Module `import` is not officially supported in v3.x and may lead to issues.

Demonstrates parsing a multi-section Redis INFO string and accessing specific properties from the resulting object.

const { parse } = require('redis-info'); const redisInfoString = ` # Server redis_version:2.4.10 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d redis_mode:standalone os:Linux 5.15.0-78-generic x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:9.4.0 process_id:1234 process_supervised:no run_id:54321deadbeef0987654321deadbeef098765 tcp_port:6379 server_time_usec:1678886400000000 uptime_in_seconds:3600 uptime_in_days:0 hz:10 lru_clock:123456789 executable:/usr/local/bin/redis-server config_file:/etc/redis/redis.conf # Clients connected_clients:1 client_recent_max_input_buffer:2 client_recent_max_output_buffer:0 blocked_clients:0 # Memory used_memory:1048576 used_memory_human:1.00M used_memory_rss:2097152 used_memory_rss_human:2.00M used_memory_peak:1048576 used_memory_peak_human:1.00M `; const info = parse(redisInfoString); console.log('Redis Version:', info.redis_version); console.log('OS:', info.os); console.log('Connected Clients:', info.connected_clients); console.log('Memory Used Human:', info.used_memory_human); // Example of accessing a non-existent property (returns undefined) console.log('Replication Role (may not exist in old Redis versions):', info.role);
Debug
Known issues
gotchaRedis `INFO` command output varies significantly across different Redis server versions (e.g., Redis 2.x, 3.x, 4.x, 5.x, 6.x, 7.x, 8.x). The `redis-info` parser (v3.1.0, published 4-5 years ago) may not fully or correctly parse `INFO` output from newer Redis versions, leading to missing or incorrectly interpreted fields.
fix
Manually inspect the parsed output to ensure accuracy. If critical fields are missing or incorrect, consider implementing custom parsing logic or using a more actively maintained Redis client library that integrates up-to-date `INFO` parsing.
affects: all versions of `redis-info` when used with Redis server versions released after `redis-info` v3.1.0's publication.
gotchaThe `redis-info` package, especially version 3.1.0, is built as a CommonJS module. Direct ES Module `import` syntax might not work as expected without a transpilation step or specific Node.js configuration, leading to `TypeError` or `SyntaxError`.
fix
Use CommonJS `require` syntax: `const { parse } = require('redis-info');`. If you must use ES Modules, consider dynamic `import()` or ensure your build tooling handles CJS interoperability.
affects: >=3.0.0
Errors
Common errors & fixes
TypeError: (0 , redis_info_1.parse) is not a function
Attempting to import the CommonJS `redis-info` package using incorrect ES Module syntax like `import { parse } from 'redis-info';`.
fix
Use CommonJS `require` syntax: `const { parse } = require('redis-info');`.
Output from `redis-info.parse()` is missing expected fields or shows incorrect values for recent Redis versions.
The `redis INFO` command output format evolves with new Redis server versions. `redis-info` v3.1.0 might not be updated to handle fields introduced in newer Redis server versions (e.g., Redis 6.x, 7.x, 8.x) or correctly interpret changed field structures.
fix
Verify the Redis server version and compare its `INFO` output with the `redis-info` parser's behavior. Manually inspect the raw `INFO` string and the parsed object. Consider reporting an issue to the library maintainer or implementing a custom parser for missing fields if using a very recent Redis version.
Upgrade
Version history
0.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
Meta
1
Resources
redis-info — npm install redis-info · libregistry