c0
    Preparing search index...

    Class Builder

    Builds C0DATA documents in compact form.

    Names (file/group labels, headers, reference targets) are strings and reject control bytes. Values (record fields, list items, blocks, items, ETB payloads) are byte-transparent: pass a string for UTF-8 text or a Uint8Array for raw bytes; control bytes are DLE-escaped automatically.

    Example: const buf = build(b => { b.file('mydb', () => { b.group('users', ['name', 'amount', 'type'], () => { b.record('Alice', '1502.30', 'DEPOSIT') b.record('Bob', '340.00', 'WITHDRAWAL') }) }) })

    Index
    • Write an ETB commit marker (stream mode), with an optional integrity payload. The payload may not contain control bytes — it is terminated by the next control code on read.

      Parameters

      Returns this

    • Write a file/database scope.

      Parameters

      • name: string
      • Optionalfn: () => void

      Returns this

    • Write a group/table scope with optional headers.

      Parameters

      • name: string
      • Optionalheaders: string[] | null
      • Optionalfn: () => void

      Returns this

    • Write a standalone SOH header (e.g. for stream mode, where the header is appended and committed separately from the group).

      Parameters

      • names: string[]

      Returns this

    • Write a field whose value is a flat list (spec: "arrays are US-separated values inside STX/ETX"): US, STX, the items separated by US, ETX. Read back with Record#list.

      Parameters

      Returns this

    • Write a nested sub-structure.

      Parameters

      • fn: () => void

      Returns this

    • Write a reference: one segment is ENQ + group name, more is a path (ENQ STX segments-joined-by-US ETX). Reference targets are names, so control bytes are rejected.

      Parameters

      • ...path: string[]

      Returns this

    • Write GS×N for document-mode depth.

      Parameters

      • name: string
      • depth: number = 1
      • Optionalfn: () => void

      Returns this

    • Finalize and return the buffer.

      Returns Uint8Array