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 f1f9aff

Browse filesBrowse files
ghaiklorevanlucas
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 2a5c6d7 commit f1f9aff
Copy full SHA for f1f9aff

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
@@ -1054,8 +1054,10 @@ const buf = Buffer.from([1,-2,3,4]);
10541054

10551055
buf.readInt32BE();
10561056
// returns 33424132
1057-
buf.readInt32LE(1);
1057+
buf.readInt32LE();
10581058
// returns 67370497
1059+
buf.readInt32LE(1);
1060+
// throws RangeError: Index out of range
10591061
```
10601062

10611063
### 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.