Optionaloptions: { workerUrl?: string | URL }Parse a SharedArrayBuffer-backed IFC payload in a Web Worker.
The buffer is shared by reference — the caller may keep a Uint8Array
view of the same SAB on the main thread (e.g. for the geometry worker
pre-pass). The worker neither transfers nor mutates the buffer.
Optionaloptions: WorkerParserOptionsHand the worker a pre-built entity index (typically from the streaming
geometry pre-pass). May be called before or after parseColumnar —
if before, the payload is queued and posted as soon as the worker is
spawned. The parser worker uses the index to skip its WASM scan.
oversizedIdCount is how many records the pre-pass refused for an express
id above the u32 bound (#3395). Pass it: the columns cannot carry a record
that was refused, so a caller that drops the number leaves the parse
reporting a clean load that is short by exactly that many entities.
malformedRecordCount is the same handoff for the pre-pass stopping early
at a record whose string or comment never closed (#3790). Pass it too: a
stop costs the whole tail of the file, not one record, and the columns
carry no trace of where it happened.
OptionaloversizedIdCount: numberOptionalmalformedRecordCount: numberTerminate the worker if running. Safe to call repeatedly.
#4896: an in-flight parseColumnar promise only ever settled on
complete/error/onerror/onmessageerror — none of which fire once
the worker is killed, so the documented "call terminate() to cancel"
path hung the caller's await forever. terminate() now rejects EVERY
in-flight request with an AbortError and tears down each one's worker,
so cancellation is distinguishable from both a successful parse and a
parse failure. To cancel just one of several overlapping parses, abort
that request's signal instead.
StaticisReturns true when this runtime can run the parser worker:
Worker constructor available, SharedArrayBuffer available, and
cross-origin-isolated. Callers should check this before allocating
a SAB and falling through to the in-process parser when it returns
false. The parser itself is SAB-decode-safe (see utf8-decode.ts),
so no TextDecoder probe is needed here.
Browser-only exports for @ifc-lite/parser
These exports use Vite-specific features (worker imports) and are only available in browser environments with bundlers that support them.
Usage: import { WorkerParser } from '@ifc-lite/parser/browser';