Interface: Gukhanmun

A configured hanja-to-hangul converter. Created by calling GukhanmunFactory.load (or the top-level load function).

The instance is immutable after creation; call load again to obtain a converter with different options.

Properties

options

readonly options: Readonly<Required<Omit<GukhanmunOptions, "dictionaries" | "directives" | "html" | "originalGloss">>>

Read-only view of the resolved options (after preset defaults are applied). Excludes dictionaries, directives, html, and originalGloss, which are not meaningfully representable as plain values.

Methods

convert()

convert(source, format?): string

Converts source to hangul in one shot. Buffers the entire input before returning.

Parameters

source

string

The text to convert.

format?

Format

Input / output format. Defaults to "text".

Returns

string

The converted text.

Throws

GukhanmunError on conversion failure.


stream()

stream(format?): TransformStream<string, string>

Returns a TransformStream<string, string> that converts chunks incrementally. Chunks are JavaScript strings; byte-level encoding is the caller's responsibility (TextDecoderStream / TextEncoderStream).

The stream guarantees that the concatenated output equals the result of calling convert on the concatenated input, regardless of chunk boundaries. Document-wide middlewares (e.g., homophone marking with homophoneWindow: "per-document") buffer until the writable side is closed.

Parameters

format?

Format

Input / output format. Defaults to "text".

Returns

TransformStream<string, string>

A platform TransformStream<string, string>.

Throws

GukhanmunError on initialisation failure (not on chunk errors; those are signalled via the stream's error channel).