将数据序列化为 JSON 并写入文件。
要写入数据的类型。
文件路径。
要写入的数据。
写入操作的异步结果。
const result = await writeJsonFile('/path/to/config.json', { name: 'test' });if (result.isOk()) { console.log('写入成功');} Copy
const result = await writeJsonFile('/path/to/config.json', { name: 'test' });if (result.isOk()) { console.log('写入成功');}
将数据序列化为 JSON 并写入文件。