Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
method Buffer.prototype.readUIntLE
import { Buffer } from "https://deno.land/std@0.135.0/node/_buffer.d.ts";

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

This function is also available under the readUintLE alias.

import { Buffer } from 'buffer';

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

console.log(buf.readUIntLE(0, 6).toString(16));
// Prints: ab9078563412

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