Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1x 1x 1x 1x 1x | import fs from 'fs' export function createFile(fileName, data) { const jsonContent = JSON.stringify(data, null, '\t'); fs.writeFile(`${process.cwd()}/${fileName}`, jsonContent, 'utf8', function (err) { Iif (err) { console.log('\x1b[31m', "An error occured while writing JSON Object to File."); return console.log(err); } console.log('\x1b[32m', `Your file has been saved in ${process.cwd()}/output/${fileName}.`); }); } |