Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/api/buffer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ const buf = new Buffer([1,-2,3,4]);
buf.readInt16BE();
// returns 510
buf.readInt16LE(1);
// returns -511
// returns 1022
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the original intent was to read the same two bytes.
cc @jasnell who I believe added this example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Will update to whatever @jasnell thinks here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was a typo on my part... the second one should be buf.readInt16LE(); (no argument passed in)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that said, this change works too

```

### buf.readInt32BE(offset[, noAssert])
Expand Down