Buffer Module in Node.js provides access to Buffer objects that represent fixed-length sequences of bytes. readDoubleBE()
is a method defined in the Buffer Class that reads a 64-bit, big-endian double from the Buffer object starting from the specified offset. The prototype of readDoubleBE
is as follows:
buf.readDoubleBE([offset])
offset
: Number of bytes to skip before reading. offset
must be an integer and lie in the range . The default value is .
64-bit, big-endian double from buf
starting from the specified offset.
NOTE: Buffer Class is accessible within the global scope. Therefore, you do not need to use the
require('buffer').Buffer
method to import the Buffer Module.
const buf = Buffer.from([1, 62, -83, 4, 25, 6, 37, 18, -10]);console.log(buf.readDoubleBE(1));
In the first line, we create the buffer object buf
using Buffer.from()
. Then, we display the 64-bit, big-endian double value from buf
after skipping 1 byte by passing offset
1 to the buf.readDoubleBE()
method.
Free Resources