I'm trying to decode bins' data returned by an aerospike get query using nodejs but i keep getting data containing weird \u0003
unicode characters.
I have stored the data in aerospike using a simple script much like the default example
'use strict';
const Aerospike = require('aerospike');
const key = new Aerospike.Key('test', 'test_set', '1234');
const client = Aerospike.client({hosts: '127.0.0.1'});
const bins = {
test: {
'123': '1',
'456': '1'
}
};
client.connect((err) => {
if(err) return console.error('Could not connect to aerospike', err);
return client.put(key, bins, (err) => {
if(err) return console.error('Error when inserting data', err);
console.log('Record has been written');
});
});
I then retrieve the key bins and their associated values.
82a403313233a20331a403343536a20331
is the hex content of the bin test
that we previously inserted.
When decoded using various nodejs msgpack libraries:
- https://github.com/mcollina/msgpack5
- https://github.com/pgriess/node-msgpack
- https://github.com/kawanet/msgpack-lite
I always get the same result which is not what i inserted in the first place:
{
test: {
'\u0003123': '\u00031',
'\u0003456': '\u00031'
}
}
All the msgpack libraries i tried seem to match the msgpack spec described here which means that Aerospike uses an alternate format based on msgpack.
If that's the case where can i find this alternate protocol ?