Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Const create

  • create(file: string): true
  • Creates an empty json file if one does not already exist

    Parameters

    • file: string

      path of the file to create

    Returns true

    true

Const get

  • get<T>(file: string): T
  • Returns the contents of a json file as an object.

    Creates an empty file if one does not already exist.

    Type parameters

    • T = any

    Parameters

    • file: string

      path of the file to read

    Returns T

    • the contents of the file

update

  • update<T>(file: string, data: Partial<T>): void
  • update<T>(file: string, data: Partial<T>, merge: true): void
  • update<T>(file: string, data: T, merge: false): void
  • Updates a json file. Deep merges data into the existing object.

    Type parameters

    • T = any

    Parameters

    • file: string
    • data: Partial<T>

    Returns void

  • Updates a json file. Deep merges data into the existing object.

    Type parameters

    • T = any

    Parameters

    • file: string
    • data: Partial<T>
    • merge: true

    Returns void

  • Updates a json file. Overrides the existing object with data.

    Type parameters

    • T = any

    Parameters

    • file: string
    • data: T
    • merge: false

    Returns void

Generated using TypeDoc