happy-opfs
    Preparing search index...

    Function readJsonFileSync

    • Synchronous version of readJsonFile. Reads and parses a JSON file.

      Type Parameters

      • T

        The expected type of the parsed JSON.

      Parameters

      • filePath: string

        The absolute path of the JSON file to read.

      Returns IOResult<T>

      An IOResult containing the parsed JSON object.

      readJsonFile for the async version.

      1.8.4

      interface Config { name: string; version: number }
      readJsonFileSync<Config>('/config.json')
      .inspect(config => console.log(config.name));