Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function encodeU64
Deprecated
Deprecated

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

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

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

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

Parameters

val: bigint

Returns

Uint8Array