Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dtils/deps.ts>hexEncodingUtils

The best unofficial library of utilities for Deno applications
Go to Latest
namespace hexEncodingUtils
import { hexEncodingUtils } from "https://deno.land/x/dtils@2.3.1/deps.ts";

Port of the Go encoding/hex library.

This module is browser compatible.

Examples

Example 1

import {
  decode,
  encode,
} from "https://deno.land/std@0.224.0/encoding/hex.ts";

const binary = new TextEncoder().encode("abc");
const encoded = encode(binary);
console.log(encoded);
// => Uint8Array(6) [ 54, 49, 54, 50, 54, 51 ]

console.log(decode(encoded));
// => Uint8Array(3) [ 97, 98, 99 ]

Functions

Decodes src into src.length / 2 bytes. If the input is malformed, an error will be thrown.

Encodes src into src.length * 2 bytes.