Node.js Buffer.readFloatLE() Method
The buf.readFloatLE() method is used to read a 32 bit float number from Buffer class with specified endian format. It facilitate interaction among octet streams inside TCP streams, operations of the file system and various other factors.
buffer.readFloatLE( integer )
Parameters: This method accepts single parameter offset which holds the value which tells about how many numbers of bytes to skip before initializing the read operation. The value of offset lies between 0 to buffer.length – 4. The default value is 0.
Return Value: It returns an integer value in little endian format.
Below examples illustrate the use of buf.readFloatLE() Method in Node.js:
4.063216068939723e-34 <Buffer 05 06 07 08>
internal/buffer.js:72 throw new ERR_OUT_OF_RANGE(type || 'offset', ^ RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 0. Received 2 . . .
Note: The above program will compile and run by using the
node index.js command.