1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-24 04:04:31 +00:00

Updated Buffer.from(), to allow hex encodings to start with 0x

This commit is contained in:
Bryan Roe
2019-01-18 16:20:03 -08:00
parent d64dfb5504
commit b33c9ee4b8
2 changed files with 11 additions and 1 deletions

View File

@@ -40,6 +40,11 @@ if (process.argv.length > 1)
db.Put(process.argv[2], process.argv[3]);
process.exit();
break;
case 'putx':
console.log('PUTX ' + process.argv[2] + ' = ' + process.argv[3]);
db.Put(process.argv[2], Buffer.from(process.argv[3], 'hex'));
process.exit();
break;
case 'get':
console.log('GET ' + process.argv[2] + ' = ');
var val = db.Get(process.argv[2]);
@@ -48,7 +53,7 @@ if (process.argv.length > 1)
process.exit();
break;
case 'getx':
console.log('GET ' + process.argv[2] + ' = ');
console.log('GETX ' + process.argv[2] + ' = ');
var val = db.GetBuffer(process.argv[2]);
console.log('len = ' + val.length);
console.log(val==null?'0x00':('0x' + val.toString('hex')));