Skip to content

Buffer integer writing functions return (offset + number bytes written) instead of (number bytes written) #5846

@quentinadam

Description

@quentinadam
  • Version: 5.9.0
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions