The Buffer.writeUInt16LE() method is used to write specified bytes in Little Endian format to the buffer object. Here, value should be a valid unsigned 16-bit integer.
Buffer.writeUInt16LE( value, offset )
Parameters: This method accept two parameters as mentioned above and described below:
- value: It is an integer value and that is to be written to the buffer.
- offset It is an integer value and it represents the number of bytes to skip before starting to write and the value of offset lies within the range 0 to buffer.length – 2 and its default value is 0.
Return value: It returns an integer value the offset plus number of bytes written.
<Buffer ad de 00 00> <Buffer ad de ef be>
<Buffer ed fe 00 00> <Buffer ed fe cd ab>
Note: The above program will compile and run by using the
node index.js command.