bytes isn’t a string, it’s a sequence of bytes, so the first byte would be 0x31 which can’t be extracted as two characters. And you have to return an object. Try this:
function Decoder(bytes, port) {
var decoded = {};
var str = '';
for (var n = 0; n < bytes.length; n ++) {
str += String.fromCharCode(parseInt(bytes[n]));
}
decoded.result = str;
return decoded;
}