2020-05-18 22:59:12 +01:00

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