The `redis-dump` package provides a utility for exporting data from a Redis database, offering output in two primary formats: a series of Redis commands suitable for direct re-import via `redis-cli`, or a structured JSON representation for programmatic processing. The current stable version, `0.1.10`, was last published in March 2014, indicating that the project is no longer actively maintained. Its core functionality enables users to backup, migrate, or inspect Redis data, differentiating itself by supporting both a command-line interface and a programmatic API for Node.js applications. Due to its age, it predates modern JavaScript module systems and may not be compatible with newer Redis features or Node.js versions, and has an effectively non-existent release cadence.
npm install redis-dumpVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `redis-dump` programmatically by spawning it as a child process to export Redis data in both JSON and Redis command formats, first populating some example data using a modern Redis client.
Consider using actively maintained alternatives like `ioredis` or `node-redis` for programmatic dumping and backup solutions. For CLI-based backups, `redis-cli --rdb` or `redis-cli --scan | xargs redis-cli dump` provide more robust and current options.
When integrating `redis-dump` into a Node.js application, use `require('child_process').spawn('redis-dump', args)` to execute the CLI tool with desired arguments, rather than attempting to call methods directly from the required module.Always specify connection details explicitly: `redis-dump -h <host> -p <port> -a <password>`. Use environment variables or a configuration management system to securely handle sensitive data like passwords.
Be aware that importing a generated Redis command dump will overwrite existing data for keys present in the dump. If you need to merge data or selectively restore, manual processing or filtering of the dump file is necessary before importing.
Install the package globally using `npm install -g redis-dump`. Alternatively, execute it using `npx redis-dump [OPTIONS]` or by referencing its local binary path: `$(npm bin)/redis-dump [OPTIONS]`.
Ensure your Redis server is running and accessible from the machine where `redis-dump` is executed. Verify the host, port, and password by explicitly passing them to `redis-dump` using the `-h`, `-p`, and `-a` arguments.
Use CommonJS `require()` syntax to load the module: `const program = require('redis-dump');`. Direct programmatic use of its dumping functionality is limited, as the module exports the Commander.js program object rather than a dump function.No dependency data recorded yet.