Decoding data on chirsStack

Hello,
I need your help please! I don’t found a function to converter base64 to hexa. I have tried to do it with parseInt() but it gives false result. for exemple it give me 15 for F, while F must be 17 in hexa.

Thenk you

where and on which language. please specify.

1 Like

in JavaScript with Node Js

Hello,

Are you trying to decode data on a separate application written in JS and use Node.js rather than using the decoder function in the ChirpStack Application Server? Because ChirpStack Application Server does not use Node.js as far as I know.

If you are indeed trying to convert the base64 string to an array of hexadecimal numbers using Node.js, you should see this documentation of Buffer in Node.js. You can use the base64 encoding when converting from base64 string using Buffer.

1 Like

Thank you for your rethink.
Indeed,i realized afterwards that i had to use the " BUFFER". Now I try to check just the code working on Node Js before copying it on ChirpStack. I hope there won’t be much difference between the two.

Good day

Hi, I’m using these functions for replacing Buffer’s ones

1 Like

Thank you for your replay :slight_smile:

Hello,
Ineed your help please!

I am looking for a fonction to round to the unit(fonction equivalent to “Math.round()”) and fonction tohave two digits after the decimal point(fonction equivalent to “toFixed(2)” , which i can use in ChirpStack.

Good Day

Thank you for your replay, but this fonctions are not recognized in chirpStack:(

Try this one:
var result = “”;
for(var i = 0; i < bytes.length; ++i){
result+= (String.fromCharCode(bytes[i]));
}
var decodedStr = (result).toString(‘base64’);

1 Like

Thank you for your replay,i try this one