/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/utils/upgrade/src/modules/json/file.ts
15 строк
434 B
Ben Irvin
feat: Upgrade Tool
08 янв 2024, 13:26
Не верифицирован
08 янв 2024, 13:26
7d13a12
Код
Авторство
О чём код?
import fse from 'fs-extra'; import type { Utils } from '@strapi/types'; export const readJSON = async (path: string): Promise<Utils.JSONValue> => { const buffer = await fse.readFile(path); return JSON.parse(buffer.toString()); }; export const saveJSON = async (path: string, json: Utils.JSONValue): Promise<void> => { const jsonAsString = `${JSON.stringify(json, null, 2)}\n`; await fse.writeFile(path, jsonAsString); };