@backblaze-labs/b2-sdk - v0.1.0
    Preparing search index...

    Class FileAccountInfo

    Node-only AccountInfo backend that persists the authorization response to a JSON file. Upload URL pools remain in memory because URLs are short-lived and shouldn't be shared across processes.

    On instantiation, call FileAccountInfo.load to populate state from disk (or start fresh if the file is missing or corrupt). The authorization response is written back to disk on every setAuth or clear call so a process restart can resume without re-authorizing.

    This module imports node:fs/promises; do not load it in browser bundles.

    Implements

    Index

    Constructors

    • Constructs a FileAccountInfo bound to a JSON file on disk. The file is created on the first setAuth write; reading it back happens via load.

      Parameters

      • path: string

        Absolute path to the JSON file that backs this account info.

      Returns FileAccountInfo

    Properties

    path: string

    Absolute path to the JSON file that backs this account info.

    Methods

    • Awaits any pending disk writes. Call before process exit to ensure the latest state is persisted.

      Returns Promise<void>

      A promise that resolves once all queued writes are flushed.

    • Reads the JSON file at the configured path and populates in-memory state. If the file is missing or contains invalid JSON, leaves state empty and returns silently (a re-auth is expected next).

      Returns Promise<void>

      A promise that resolves when load is complete.