Skip to content

Commit

Permalink
doc: fix doc for Buffer.readInt32LE()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ghaiklor authored and evanlucas committed Mar 31, 2016
1 parent 2a5c6d7 commit f1f9aff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/api/buffer.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,10 @@ const buf = Buffer.from([1,-2,3,4]);

buf.readInt32BE();
// returns 33424132
buf.readInt32LE(1);
buf.readInt32LE();
// returns 67370497
buf.readInt32LE(1);
// throws RangeError: Index out of range
```

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

0 comments on commit f1f9aff

Please sign in to comment.