Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/ext/node/polyfills/buffer.ts>Buffer#readUIntBE

A modern runtime for JavaScript and TypeScript.
Go to Latest
method Buffer.prototype.readUIntBE
import { Buffer } from "https://deno.land/x/deno@v1.39.0/ext/node/polyfills/buffer.ts";

Reads byteLength number of bytes from buf at the specified offsetand interprets the result as an unsigned big-endian integer supporting up to 48 bits of accuracy.

This function is also available under the readUintBE alias.

import { Buffer } from "ext:deno_node/internal/buffer";

const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

console.log(buf.readUIntBE(0, 6).toString(16));
// Prints: 1234567890ab
console.log(buf.readUIntBE(1, 6).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.

Returns

number