You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Buffer integer writing functions return (offset + number bytes written) instead of (number bytes written) #5846
Platform: Mac OS X 10.11.3 64-bit (Darwin Kernel Version 15.3.0)
When using the convenience methods to write integers to Buffer objects (like for example buf.writeUInt32LE(value, offset[, noAssert])), the value returned is (offset + number bytes written) instead of (number bytes written) as is indicated in the documentation.
Test case :
var buf = new Buffer(100);
var value = 1;
var offset = 20;
console.log(buf.writeUInt32LE(value, offset)); //outputs 24 instead of 4
This issue seems to appear with all integer writing functions.
Activity
jasnell commentedon Mar 22, 2016
Yep, the documentation is wrong and has been fixed in master. See: #5736