Files
freeCodeCamp/utils/open-json-file.js
2018-12-03 00:09:23 +05:30

10 lines
212 B
JavaScript

const fs = require('fs');
const openJSONFile = fileName => {
const data = JSON.parse(fs.readFileSync(fileName, 'utf8'));
console.log('Opened JSON file')
return data;
};
module.exports = { openJSONFile };