Interface: FileDictionarySource

Specifies a dictionary loaded from a binary file or URL.

The data field accepts:

  • A BufferSource (ArrayBuffer or ArrayBufferView) — supported in all environments.
  • A URL — resolved via fetch in browsers; via node:fs/promises in Node.js, Deno 2.0+, and Bun.
  • A string — treated as a filesystem path; supported in Node.js, Deno 2.0+, and Bun only. Throws in browser environments.

At runtime, a FileDictionarySource is distinguished from other values by the presence of a format property ("format" in source).

Properties

data

readonly data: string | URL | ArrayBuffer | ArrayBufferView<ArrayBufferLike>

The binary dictionary data or a reference to where it can be loaded.

Pass a BufferSource for data already in memory, a URL for a remote or local URL (resolved via fetch or readFile), or a path string for filesystem paths (Node.js / Deno 2.0+ / Bun only).


format

readonly format: "fst" | "cdb"

The on-disk format of the dictionary file.

  • "fst" — Gukhanmun FST file (*.gukfst); preferred for small WebAssembly bundles. Supported in all runtimes.
  • "cdb" — Gukhanmun CDB-trie file (*.gukcdb); preferred when code auditability or trivial mmap support matters. Requires a filesystem or in-memory bytes; supported in Node-API and (with from_bytes) in WASM builds that include the cdb feature.

The "tsv" format is reserved for future use; passing it throws GukhanmunError with code "unsupported-content-type".