Node.js Buffer.readInt16BE() Method Read Courses Improve Improve Improve Like Article Like Save Article Save Report issue Report The Buffer.readInt16BE() Method is an inbuilt application programming interface of class Buffer with in Buffer module which reads a 16-bit signed integer from the buffer at the specified offset in the big endian format. Syntax: Buffer.readInt16BE( offset ) Parameters: This method accepts a single parameter offset which specifies the number (integer) of bytes to skip before starting to write. The value of offset lies within the range 0 <= offset <= buf.length – 2. Its default value is zero. Return value: It returns the offset along with number of bytes written. Example 1: // Node.js program to demonstrate the // Buffer.readInt16BE() method // Create a buffer const buf = Buffer.from([0, 3]); // Display the result console.log(buf.readInt16BE(0)); Output: 3 Example 2: // Node.js program to demonstrate the // Buffer.readInt16BE() method // Create a buffer const buf = Buffer.from([0, 3]); // Display the result console.log(buf.readInt16BE(1)); Output: 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 1 . . . Reference:https://nodejs.org/api/buffer.html#buffer_buf_readint16be_offset Last Updated : 13 Oct, 2021 Like Article Save Article Previous Node.js Buffer.writeInt16BE() Method Next Node.js Buffer.entries() Method Share your thoughts in the comments Add Your Comment Please Login to comment...