2020-05-19 12:17:36 +01:00

16 lines
317 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();