2020-04-13 15:44:06 +01:00

15 lines
335 B
JavaScript

const fs = require("fs").promises;
const path = require('path');
const filepath = path.join(process.cwd(), 'hello.txt');
async function run() {
try {
const contents = await fs.readFile(filepath, 'utf8');
console.log("File Contents:", contents);
} catch (error) {
console.error(error);
}
};
run();