Skip to content

buf.readUIntBE and buf.readUIntLE documentation examples are switched #8227

Closed
@mozkeeler

Description

@mozkeeler
  • Version: v6.4.0
  • Platform: Linux x260 4.6.5-200.fc23.x86_64 deps: update openssl to 1.0.1j #1 SMP Thu Jul 28 01:10:25 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem:

The documentation at https://nodejs.org/api/buffer.html#buffer_buf_readuintbe_offset_bytelength_noassert has a few examples, reproduced in part here:

const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

// Prints: 1234567890ab
console.log(buf.readUIntLE(0, 6).toString(16));

// Prints: ab9078563412
console.log(buf.readUIntBE(0, 6).toString(16));

However, the comments describing the output are the opposite of what they should be. The LE example outputs "ab9078563412" whereas the BE example outputs "1234567890ab".

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.docIssues and PRs related to the documentations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions