UCD.js Docs

UCD Store

Manage mirrored local stores and remote store-compatible Unicode data access

The @ucdjs/ucd-store package is the high-level coordination layer for Unicode Character Database storage access. It can operate as a mirrored local store or as a remote store-compatible view over HTTP, exposes the resolved store.mode, and coordinates lockfile/snapshot metadata, file access, mirroring, sync, verification, and reporting.

Installation

npm install @ucdjs/ucd-store

Overview

A mirrored store is a directory on disk containing UCD files organized by version. It is described by a .ucd-store.lock lockfile that records which versions are tracked plus per-version snapshot metadata. Remote stores expose the same file-oriented read surface without the local mirroring lifecycle.

Modes

Store instances expose a mode property:

  • mirrored: writable local store lifecycle with lockfile and snapshot state
  • remote: read-only store-compatible access backed by the store HTTP surface and API metadata

Core Operations

OperationDescription
mirrorDownload UCD files for one or more versions
syncBring the store on disk in line with the lockfile
verifyCheck local files against the remote API
analyzeReport on the contents and status of the store
statusShow which versions are present and their state

All of these operations are available through the ucd store CLI commands without writing any code.

File System Backends

The store works with filesystem-style backends for local disk access, remote HTTP access, and testing-friendly in-memory implementations. In the public docs, the backend model is documented through @ucdjs/fs-backend.

If you are building tooling around store-style file access, start with @ucdjs/fs-backend.

Lockfile

The .ucd-store.lock file is the source of truth for a mirrored local store. It records:

  • Which Unicode versions are tracked
  • Which files belong to each version
  • A content hash per file for integrity verification

The lockfile is written on init and mirror, and read by sync and verify to determine what should be on disk.

Typical Lifecycle

This is the most common high-level usage flow for a writable store.

Filesystem backendUCD APIUCD StorecreateNodeUCDStore()Filesystem backendUCD APIUCD StorecreateNodeUCDStore()Consumer app / CLIcreateNodeUCDStore({ basePath, versions, requireExistingStore: false })createUCDStore(...)discover config + list versionsread or create .ucd-store.lockstore instancemirror({ versions })get file tree + fetch fileswrite files + snapshot + lockfileMirrorReportfiles.get(version, path)read local filefile contents{ data, error }analyze()inspect local files + snapshotsAnalysisReportConsumer app / CLI

For the method-level execution diagrams, see the ucd-store architecture notes.

API Reference

Documentation for the programmatic API will be added as the package stabilizes.

On this page