Node.js Buffer.writeIntLE() Method
Buffer is a temporary memory storage which stores the data when it is being moved from one place to another. It is like an array of integers.
The Buffer.writeIntLE() method writes the byteLength bytes of values to Buffer using Little Endian format to the Buffer object.
Buffer.writeIntLE( value, offset, byteLength )
Parameters: This method accept three parameters as mentioned above and described below:
- value: It holds an integer value number which to be written to the Buffer.
- offset: It holds an integer value i.e. number of bytes to skip before starting to write into the buffer. The value of offset lies 0 <= offset <= buf.length – byteLength.
- byteLength: It holds the number of bytes to write into the buffer. The value of byteLength lies 0 < byteLength <= 6.
Return Value: It returns an integer value offset plus the number of bytes written.
<Buffer 00 00 00 00 00 46 6f 72 47 65 65 6b 73> ForGeeks
<Buffer ef cd ab 00>
Note: The above program will compile and run by using the
node index.js command.