Skip to content

@idfkit/core/node

Node-only conveniences: reading and writing files, and resolving a schema for a version detected in a file. This is the asynchronous edge of the library, kept separate so that the portable core never has to be async and browser bundles never pull in node:fs.

import { loadIdf, saveIdf } from '@idfkit/core/node';
Interfaces

LoadOptions

Properties

bundle

Use a specific bundle rather than the default.

onDiagnostic

Collects diagnostics when strict is false.

preserveFormatting

Retain the source text and the anchoring, so a later writeIdf can reproduce it.

Off by default, and the option gates every piece of the new work: a caller who does not ask pays neither the scan nor the retention, and reading costs exactly what it costs today.

When it is on, the read makes ONE pass and builds both the objects and the syntax layer from it, so the cost is the layer's own budget rather than a second read of the text.

The retained material hangs off the document, reachable as IdfDocument.rawText. It is not returned beside the document: ParseResult carries exactly two keys and a test pins that it does.

strict

Throw on the first diagnostic instead of collecting them.

version

Force a schema version instead of reading it from the file.

Functions

loadEpJson

loadIdf

loadIdfWithDiagnostics

saveEpJson

saveIdf

schemaFor

schemas