Skip to main content
Module

std/encoding/varint.ts>encodeU32

Deno standard library
Go to Latest
function encodeU32
Deprecated
Deprecated

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

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.180.0/encoding/varint/mod.ts";

const encodedValue = encodeU32(42);
// Do something with the encoded value
import { encodeU32 } from "https://deno.land/std@0.180.0/encoding/varint.ts";

Parameters

val: number

Returns

Uint8Array