Skip to main content
Version: v0.0.3

Function: inspectFormat()

inspectFormat(format, bytes): Promise<InspectSummary>

Build the value-free structural summary of one input of format: counts and structural type codes only, never a field value.

Parameters

format

CosyteFormat

A format for which supportsOp(format, "inspect") is true.

bytes

Uint8Array

The input bytes.

Returns

Promise<InspectSummary>

A InspectSummary variant for the format.

Throws

CLI_PARSER_UNAVAILABLE if the optional parser is absent; the wrapped parser's rejection propagates for the command's value-free failure boundary.

Example

import { inspectFormat } from "@cosyte/cli";

const bytes = new TextEncoder().encode('{"resourceType":"Patient"}');
(await inspectFormat("fhir", bytes)).format; // => "fhir"