You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

redis-drs

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-drs

redis-drs - A Redis Dump, Restore and Sync Tool

1.3.11
latest
Source
npmnpm
Version published
Weekly downloads
16
-96.65%
Maintainers
0
Weekly downloads
 
Created
Source

redis-drs - A Redis Dump, Restore and Sync Tool

Inspired by pyredis-dump

Build on top of ioredis, so it's offer all ioredis features

Features

  • Supports all Redis data types;
  • Dump/Restore/Sync TTL and expiration times;
  • Dumps are human readable
  • Dumps are line-aligned (can be streamed)
  • Can load TTL OR original expiration time for expiring keys;
  • Can be used as a module in a larger program or as a standalone utility

Usage

CLI Basic Example

npm i -g redis-drs

redis-drs dump --filePath dump.csv --uri redis://localhost:6379/0 --pattern 'username:*'
redis-drs restore --filePath dump.csv --uri redis://localhost:6380/0
redis-drs sync --sourceUri redis://localhost:6379/0 --targetUri redis://localhost:6380/0

# For help
redis-drs dump --help

Package Basic Example

npm i -S redis-drs

Dump

import { RedisDRS } from 'redis-drs';

const redis = new RedisDRS({ path: 'redis://localhost:6379/0' });
const data = redis.dump({ filePath: 'dump.csv', pattern: 'username:*' });

// Total keys is always the first item in the iterator
const total = (await data.next()).value as number;
console.log(`Total keys: ${total}`);

for await (const val of data) {
    // Here you can reach data stream copy
}

redis.disconnect();

Restore

import { RedisDRS } from 'redis-drs';

const redis = new RedisDRS({ path: 'redis://localhost:6379/0' });
const data = await redis.restore({
    filePath: 'dump.csv',
    useTtl: true,
    bulkSize: 1000,
});

// Total keys is always the first item in the iterator
const total = (await data.next()).value as number;
console.log(`Total keys: ${total}`);

for await (const val of data) {
    // Here you can reach data stream copy
}

redis.disconnect();

Sync

import { RedisDRS } from 'redis-drs';

const redis = new RedisDRS({ path: 'redis://localhost:6379/0' });
const data = await redis.sync({
    targetRedisOptions: { path: 'redis://localhost:6380/0' },
    pattern: 'username:*',
    useTtl: true,
});

// Total keys is always the first item in the iterator
const total = (await data.next()).value as number;
console.log(`Total keys: ${total}`);

for await (const val of data) {
    // Here you can reach data stream copy
}

redis.disconnect();

Keywords

redis

FAQs

Package last updated on 23 Jul 2025

Did you know?

Socket

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.

Install

Related posts