diff --git a/client/src/modules/utils.js b/client/src/modules/utils.js index 8caa9a0b..25b39d2e 100644 --- a/client/src/modules/utils.js +++ b/client/src/modules/utils.js @@ -121,6 +121,15 @@ class FileUtils { }); } + static async writeFile(path, data) { + return new Promise((resolve, reject) => { + fs.writeFile(path, data, err => { + if (err) return reject(err); + resolve(); + }); + }); + } + static async readJsonFromFile(path) { let readFile; try { @@ -136,6 +145,10 @@ class FileUtils { throw (Object.assign(err, { path })); } } + + static async writeJsonToFile(path, json) { + return this.writeFile(path, JSON.stringify(json)); + } }