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: https://github.com/nodejs/node/issues/5889
PR-URL: https://github.com/nodejs/node/pull/5890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
ghaiklor 2016-03-24 20:45:43 +02:00 committed by Sakthipriyan Vairamani
parent 41feaa89e0
commit 1213535701

View File

@ -1067,8 +1067,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])