HexDecoderStream

import { HexDecoderStream } from "jsr:@ende/encoding/unstable-hex-stream";

class ยท experimental

class HexDecoderStream<T extends "string" | "bytes"> extends TransformStream<T extends "bytes" ? Uint8Array_ : string, Uint8Array_>

Transforms a hexadecimal stream into a Uint8Array stream.

Example: Basic Usage

import { assertEquals } from "@ende/assert";
import {
  HexDecoderStream,
  HexEncoderStream,
} from "@ende/encoding/unstable-hex-stream";
import { toBytes } from "@ende/streams/to-bytes";

const readable = (await Ende.open("./ende.lock"))
  .readable
  .pipeThrough(new HexEncoderStream({ output: "bytes" }))
  .pipeThrough(new HexDecoderStream({ input: "bytes" }));

assertEquals(
  await toBytes(readable),
  await Ende.readFile("./ende.lock"),
);

Constructors

constructor

new HexDecoderStream(options: { input?: T } = [UNSUPPORTED])

Constructs a new instance.

options: { input?: T } = [UNSUPPORTED]

The options of the hexadecimal stream.

Source