Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis-dump-restore

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-dump-restore

Dump and restore Redis contents

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-20%
Maintainers
2
Weekly downloads
 
Created
Source

redis-dump-restore

NPM

NPM

Build Status Coverage Status

This is a library for Node.js to dump and restore Redis contents using DUMP and RESTORE commands.

It issues those commands using the redis npm package. You have to provide instance of the client yourself. Make sure to set return_buffers and/or detect_buffers to true (see docs) so that we get Buffer instances from the client. This is required because otherwise binary data is corrupted. Use 1.0.0+ version of the redis library - previous versions have bugs in detect_buffers handling.

Dependencies

No production-time dependencies. For the list of test-time dependencies and their versions see the package.json file.

Usage

const redis = require('redis');
const dump = require('@atlassian/redis-dump-restore').dump;
// Use this function to DUMP all values atomically (inside MULTI)
//const dump = require('@atlassian/redis-dump-restore').dumpMulti;

const clientInstance = redis.createClient('localhost', 6379, { detect_buffers: true });
const dumpEx = dump(clientInstance, '*');

dumpEx
  .on('data', function (key, data, ttl) {
    // Do something with data.
    // Both key and data are Buffers with binary data.
    // ttl is 0 if key expiration is not set, otherwise it is a positive value in milliseconds.
  })
  .on('error', function (err) {
    // Handle error
   })
  .on('end', function () {
    // We're done!
  });

To restore a dump just use the redis client's restore command for each saved key. You can do that as a single transaction if needed using MULTI.

Install instructions

In your project directory run the following command to add this library as a dependency:

npm install redis-dump-restore --save

Keywords

FAQs

Package last updated on 18 Jan 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc