Is there a reason why you set that 1KB is equal to 1000B instead of 1024B in the Companion server plugin ?
var n = Math.min(Math.floor(Math.log(e) / Math.log(1e3)), r.length - 1); e = Number(e / Math.pow(1e3, n));
instead of
var n = Math.min(Math.floor(Math.log(e) / Math.log(1024)), r.length - 1); e = Number(e / Math.pow(1024, n));
Thanks