Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6e2bfbe

Browse filesBrowse files
ghaiklorMyles Borins
authored andcommitted
doc: fix doc for Buffer.readInt32LE()
Update example of readInt32LE method. buf.readInt32LE(1) is supposed to throw an error as it has only four elements and it tries to read 32 bits from three bytes. Fixes: #5889 PR-URL: #5890 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent d275cdf commit 6e2bfbe
Copy full SHA for 6e2bfbe

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Collapse file

‎doc/api/buffer.markdown‎

Copy file name to clipboardExpand all lines: doc/api/buffer.markdown
+3-1Lines changed: 3 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,10 @@ const buf = new Buffer([1,-2,3,4]);
739739

740740
buf.readInt32BE();
741741
// returns 33424132
742-
buf.readInt32LE(1);
742+
buf.readInt32LE();
743743
// returns 67370497
744+
buf.readInt32LE(1);
745+
// throws RangeError: Index out of range
744746
```
745747

746748
### buf.readIntBE(offset, byteLength[, noAssert])

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.