UNPKG

read-file-json

Version:

Reads JSON and JSON5 from a file. Returns null if file does not exist (or is a directory) instead of throwing an Error.

14 lines 449 B
/** @module read-file-json */ declare module "read-file-json" { /** * @function * @param {string} file Path to a file * @returns {Promise<Object|null>} Object returned from json5.parse(fileString) * @example * import readFileJson from "read-file-json" * const result = await readFileJson("package.json") * result.version === "1.2.3" */ export default function(file: string): Promise<object | null>; }