Skip to content

Conversion of Buffer to Number was not correct for some numbers#39

Open
szandras2524 wants to merge 2 commits intoabstractvector:masterfrom
tamtakoe:master
Open

Conversion of Buffer to Number was not correct for some numbers#39
szandras2524 wants to merge 2 commits intoabstractvector:masterfrom
tamtakoe:master

Conversation

@szandras2524
Copy link

Hey,

I found this small issue, while the converter was not correct.

Now, it's working perfectly for me.

Header.prototype.convertBinaryToInteger = function (buffer) {
if (buffer.length == 1) return buffer.readUInt8(0);
if (buffer.length == 2) return buffer.readUInt16LE(0);
if (buffer.length == 4) return buffer.readUInt32LE(0);
return 0;
};

Thanks for your great code!

András

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants