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.
function decodeU32
Deprecated
Deprecated

(will be removed after 0.181.0) Use decode32() from std/encoding/varint.ts instead.

Decodes the given Uint8Array into a number with LEB128.

import { decodeU32 } from "https://deno.land/std@0.181.0/encoding/varint/mod.ts";
const bytes = Uint8Array.from([221, 199, 1]);
const decodedValue = decodeU32(bytes);

// Do something with the decoded value
console.log(decodedValue === 25565);
import { decodeU32 } from "https://deno.land/std@0.181.0/encoding/varint/mod.ts";

Parameters

val: Uint8Array

Returns

number