Options
All
  • Public
  • Public/Protected
  • All
Menu

Uses a JSON file to store key/value pairs.

Hierarchy

  • JsonFileStorage

Implements

Index

Constructors

Properties

filePath: string
lockIdentifier: ResourceIdentifier

Methods

  • delete(key: string): Promise<boolean>
  • entries(): AsyncIterableIterator<[string, unknown]>
  • get(key: string): Promise<unknown>
  • getJson(): Promise<Dict<unknown>>
  • getJsonSafely(): Promise<Dict<unknown>>
  • has(key: string): Promise<boolean>
  • updateJsonSafely<T>(updateFn: (json: Dict<unknown>) => T): Promise<T>
  • Updates the data in the JSON file while using a write lock.

    Type parameters

    • T

    Parameters

    • updateFn: (json: Dict<unknown>) => T

      A function that updates the JSON object.

        • (json: Dict<unknown>): T
        • Parameters

          • json: Dict<unknown>

          Returns T

    Returns Promise<T>

    The return value of updateFn.