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 encodeU32
import { encodeU32 } from "https://deno.land/std@0.177.0/encoding/varint/mod.ts";

Encodes the given number into Uint8Array with LEB128. The number needs to be in the range of 0 and 0xffffffff.

import { encodeU32 } from "https://deno.land/std@0.177.0/encoding/varint/mod.ts";

const encodedValue = encodeU32(42);
// Do something with the encoded value

Parameters

val: number

Returns

Uint8Array