Nyora (JavaScript) - v0.1.1
    Preparing search index...

    Class OtaManager

    Manages the over-the-air parser bundle and source catalog.

    Coordinates fetching the OTA manifest, downloading and SHA-256-verifying the parser bundle and source catalog, and caching them atomically per user. Reads fall back to the bundled package assets when the cache is empty.

    const ota = new OtaManager();
    const { available } = await ota.isUpdateAvailable();
    if (available) {
    const result = await ota.update();
    console.log("updated to", result.version);
    }
    Index

    Constructors

    • Initialize the manager.

      Parameters

      • options: { cacheDir?: string; timeoutMs?: number } = {}

        Optional configuration.

        • OptionalcacheDir?: string

          Directory for cached OTA artifacts. Defaults to the per-user cache directory (.../nyora/ota).

        • OptionaltimeoutMs?: number

          HTTP timeout in milliseconds for manifest and artifact fetches. Defaults to 30000.

      Returns OtaManager

    Accessors

    • get cacheDir(): string

      The directory where OTA artifacts are cached.

      Returns string

    Methods

    • Download and parse the remote OTA manifest.

      Returns Promise<OtaManifest>

      The manifest object (containing version and per-artifact url/sha256 entries).

      NyoraError If the manifest cannot be fetched, is invalid JSON, or is not a JSON object.

    • Return the manifest version currently cached, if any.

      Returns number | null

      The cached integer version, or null when nothing is cached or the cached manifest is unreadable.

    • Check whether the remote feed offers a newer version.

      Network or manifest errors are treated as "no update available" rather than propagating, so this is safe to call opportunistically.

      Returns Promise<OtaUpdateAvailability>

      An availability summary with available, installed, and latest fields. Either version may be null when unknown.

    • Download and cache the latest parser bundle and source catalog.

      The remote manifest is fetched, each artifact is downloaded and verified against its SHA-256, and all files are written atomically. When the cache is already current and force is false, nothing is downloaded.

      Parameters

      • options: { force?: boolean } = {}

        Update options.

        • Optionalforce?: boolean

          Re-download and overwrite even when already up to date.

      Returns Promise<OtaUpdateResult>

      An OtaUpdateResult describing what was applied.

      NyoraError If the manifest or an artifact cannot be fetched, or if an artifact fails SHA-256 verification.

    • Return the parser bundle source text.

      Returns string

      The cached bundle text, or the package-bundled fallback when no cache exists.

    • Return the source catalog JSON text.

      Returns string

      The cached catalog text, or the package-bundled fallback when no cache exists.