function readJsonFile(file) {
let bufferData = fs.readFileSync(file)
let stData = bufferData.toString()
let data = JSON.parse(stData)
return data
}
//Condensed
JSON.parse(fs.readFileSync("path").toString())
const path = require('path')
const fs = require('fs')
blogs = JSON.parse(fs.readFileSync(path.join(__dirname, '../data/blogs.json')).toString())
'use strict';
const fs = require('fs');
fs.readFile('student.json', (err, data) => {
if (err) throw err;
let student = JSON.parse(data);
console.log(student);
});
console.log('This is after the read call');
const fs = require("fs");
var posts = [];
fs.readFile('./data/posts.json', 'utf8', (err, data) => {
if (err) throw err;
posts = JSON.parse(data);
});
// Read Synchrously
var fs = require("fs");
console.log("
*START*
");
var content = fs.readFileSync("content.txt");
console.log("Output Content :
"+ content);
console.log("
*EXIT*
");