HexEncoderStream

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

class ยท experimental

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

Transforms a Uint8Array<ArrayBuffer> stream into a hexadecimal stream.

Example: Basic Usage

import { assertEquals } from "@ende/assert";
import { encodeHex } from "@ende/encoding/unstable-hex";
import { HexEncoderStream } from "@ende/encoding/unstable-hex-stream";
import { toText } from "@ende/streams";

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

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

Constructors

constructor

new HexEncoderStream(options: { output?: T } = [UNSUPPORTED])

Constructs a new instance.

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

The options for the hexadecimal stream.

Source