UNPKG

@cloud-cli/cli

Version:

CLI for the Cloud CLI project

14 lines (13 loc) 357 B
import { existsSync, readFileSync, writeFileSync } from 'fs'; export function readJson(path) { if (existsSync(path)) { try { return JSON.parse(readFileSync(path, 'utf-8')); } catch { } } return null; } export function writeJson(path, value) { return writeFileSync(path, JSON.stringify(value, null, 2)); }