New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redis-command-stream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-command-stream - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

test/fixtures.txt

7

help.txt

@@ -8,6 +8,9 @@

-n <db> Database number.
--pipe Output in protocol format for piping to redis-cli.
--flushdb Insert command to empty the destination database.
Examples:
redis-stream -n 5 "hotel*" | redis-cli -n 6
redis-stream -n 5 "hotel*" > export.txt
(cat export.txt | redis-cli -n 6)
redis-stream -n 5 --pipe "hotel*" | redis-cli -n 6 --pipe
redis-stream -n 5 --pipe "hotel*" > export.txt
(cat export.txt | redis-cli -n 6 --pipe)
'use strict'
var argv = require('minimist')(process.argv.slice(2), {
boolean: ['pipe', 'flushdb'],
default: {
h: '127.0.0.1',
p: 6379,
n: 1,
a: null
n: 0,
a: null,
flushdb: false,
pipe: false
}

@@ -33,2 +36,4 @@ })

var put = (argv.pipe) ? protoOut : consoleOut
var escape = (argv.pipe) ? noEscape : quotedEscape

@@ -112,2 +117,4 @@ var opsByType = {

if (err) return end(err)
if (!keys.length) return end()
if (argv.flushdb) put(['FLUSHDB'])

@@ -142,3 +149,21 @@ async.forEachSeries(keys, function(key, next) {

function put(arr) {
function protoOut(arr) {
process.stdout.write(protoStr(arr))
}
function protoStr(arr) {
var str = '*' + arr.length + '\r\n'
var cmdStr
arr.forEach(function(cmd) {
cmdStr = String(cmd)
str += '$'
str += Buffer.byteLength(cmdStr, 'utf8') + '\r\n'
str += cmdStr + '\r\n'
})
return str
}
function consoleOut(arr) {
// console.log('ECHO ' + escape(arr.join(' '))) // Debug

@@ -157,3 +182,7 @@ console.log(arr.join(' '))

function escape(str) {
function noEscape(str) {
return str
}
function quotedEscape(str) {
return '"' + str.replace(/\\/g, '\\\\').replace(/\"/g, '\\"') + '"'

@@ -160,0 +189,0 @@ }

{
"name": "redis-command-stream",
"version": "0.1.0",
"version": "0.2.0",
"description": "Dump a Redis database as a stream of commands",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -15,3 +15,3 @@ # redis-command-stream

Usage: redis-dump [OPTIONS] [key pattern]
Usage: redis-stream [OPTIONS] [key pattern]
-h <hostname> Server hostname (default: 127.0.0.1).

@@ -22,7 +22,10 @@ -p <port> Server port (default: 6379).

-n <db> Database number.
--pipe Output in protocol format for piping to redis-cli.
--flushdb Insert command to empty the destination database.
Examples:
redis-stream -n 5 "hotel*" | redis-cli -n 6
redis-stream -n 5 "hotel*" > export.txt
(cat export.txt | redis-cli -n 6)
redis-stream -n 5 --pipe "hotel*" | redis-cli -n 6 --pipe
redis-stream -n 5 --pipe "hotel*" > export.txt
(cat export.txt | redis-cli -n 6 --pipe)
```

@@ -29,0 +32,0 @@

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