function readFileAsync(path) {
return new Promise(function (resolve, reject) {
fs.readFile(path, function (error, result) {
if (error) {
reject(error);
} else {
resolve(result);
}
});
});
}
(async function() {
try {
const data = await readFileAsync('./data.json');
} catch(error) {
console.log(error);
}
})();