var content; fs.readFile(\'./Index.html\', function read(err, data) { if (err) { throw err; } content = data; }); console.log(content); >
var content; fs.readFile(\'./Index.html\', function read(err, data) { if (err) { throw err; } content = data; }); console.log(content);
The following is function would work for async wrap or promise then chains
async
then
const readFileAsync = async (path) => fs.readFileSync(path, 'utf8');