Skip to main content
Buffer.readIntBE - node__buffer.d.ts - Node documentation
method Buffer.readIntBE

Usage in Deno

```typescript import { type Buffer } from "node:node__buffer.d.ts"; ```
Buffer.readIntBE(
offset: number,
byteLength: number,
): number
Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value supporting up to 48 bits of accuracy. ```js import { Buffer } from 'node:buffer'; const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); console.log(buf.readIntBE(0, 6).toString(16)); // Prints: 1234567890ab console.log(buf.readIntBE(1, 6).toString(16)); // Throws ERR_OUT_OF_RANGE. console.log(buf.readIntBE(1, 0).toString(16)); // Throws ERR_OUT_OF_RANGE. ```

Parameters

offset: number
Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`.
byteLength: number
Number of bytes to read. Must satisfy `0 < byteLength <= 6`.

Return Type

number