mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-12-26 23:16:47 +01:00
@@ -16,7 +16,12 @@ module.exports = function(RED) {
|
||||
value = cbor.decode(value);
|
||||
RED.util.setMessageProperty(msg,node.property,value);
|
||||
node.send(msg);
|
||||
node.status({text:l +" b->o "+ JSON.stringify(value).length});
|
||||
if (typeof value === 'bigint') {
|
||||
node.status({text:l +" b->o "+ value.toString().length});
|
||||
}
|
||||
else {
|
||||
node.status({text:l +" b->o "+ JSON.stringify(value).length});
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
node.error("Bad decode",msg);
|
||||
@@ -24,7 +29,13 @@ module.exports = function(RED) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
var le = JSON.stringify(value).length;
|
||||
var le;
|
||||
if (typeof value === 'bigint') {
|
||||
le = value.toString().length;
|
||||
}
|
||||
else {
|
||||
le = JSON.stringify(value).length;
|
||||
}
|
||||
value = cbor.encode(value);
|
||||
RED.util.setMessageProperty(msg,node.property,value);
|
||||
node.send(msg);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name" : "node-red-node-cbor",
|
||||
"version" : "1.0.1",
|
||||
"version" : "1.0.2",
|
||||
"description" : "A Node-RED node to pack and unpack objects to cbor format",
|
||||
"dependencies" : {
|
||||
"cbor-x" : "^1.3.2"
|
||||
"cbor-x" : "^1.6.0"
|
||||
},
|
||||
"bundledDependencies": [
|
||||
"cbor-x"
|
||||
|
||||
Reference in New Issue
Block a user