0

I need to create a Redis key which is composed of a string and msgpack concatenated together.

The key looks like this (in redis db):

"a:b:c:\xcd\x10\xd8"

The message pack portion is this:

'\xcd\x10\xd8'

(translates to 4312)

my code is similar to this:

var msgpack = require("msgpack-lite");
var encoded = msgpack.encode(4312);
key = "a:b:c:" + encoded;

I've also tried like this:

var b1 = new Buffer("a:b:c:");
var b2 = new Buffer(mspacked);
var parts = [b1, b2];
key = Buffer.concat(parts);

the msgpack portion is correct until it is concatenated to the string.

I assume that this is an issue with the javascript string type and the way I am trying to handle it

Avba
  • 14,822
  • 20
  • 92
  • 192

0 Answers0