import { promises as fs } from 'fs';
export default async function loadJsonFile(path, json) {
    const data = JSON.stringify(json, null, 2);
    try {
        await fs.writeFile(path, data, {
            encoding: 'utf-8',
        });
    }
    catch (e) {
        throw new Error(`Unable to write to ${path} with the given JSON: ${data}`);
    }
}
