Node.js | Buffer.writeFloatLE() Method
The Buffer.writeFloatLE() method is an inbuilt application programming interface of class Buffer with in Buffer module that writes a value to the buffer at the specified offset with the specified little endian format. Note that the value must be a valid 32-bit float.
Buffer.writeFloatLE( value, offset )
Parameters: This method accepts two parameters as mentioned above and described below:
- value: This parameter holds a number that is to be written to the buffer.
- offset: This parameter holds the number (integer) of bytes to skip before starting to write. The value of offset lies between 0 to buf.length-4. Its default value is 0.
Return value: It returns the offset along with number of bytes written.
<Buffer b4 a2 91 55 62 01 00 00 38 e0>
<Buffer ff ca 2b 53>
Note: The above program will compile and run by using the
node index.js command.