Function: loanwordsFstBytes()

loanwordsFstBytes(url?): Promise<Uint8Array<ArrayBuffer>>

Loads the bundled NIKL loanword examples as raw bytes.

The access strategy is chosen from the URL scheme, not from the host runtime. A file: URL is read from disk with node:fs/promises (Node.js, Deno, and Bun all provide it, and it is the only option since Node.js's fetch rejects file: URLs); any other scheme is retrieved with fetch.

Branching on the scheme is what makes a JSR install work on Deno: there import.meta.url (and therefore loanwordsFstUrl) is an https: URL, yet Deno also exposes process.versions.node, so a runtime sniff would wrongly take the node:fs path and readFile would reject the https: URL with "The URL must be of scheme file".

Parameters

url?

URL = loanwordsFstUrl

Location of the FST binary to read. Defaults to the bundled loanwordsFstUrl; pass another URL to load a relocated copy.

Returns

Promise<Uint8Array<ArrayBuffer>>

The FST binary as a Uint8Array.