Skip to content

@longmo-utils/node / readJson

Function: readJson()

ts
function readJson<T>(filePath): Promise<T>;

读取 JSON 文件

Type Parameters

Type ParameterDefault type
Tany

Parameters

ParameterTypeDescription
filePathstring文件路径

Returns

Promise<T>

解析后的 JSON 数据

Example

ts
const data = await readJson('./config.json')

Released under the MIT License.